

from xpy3lib.XRetryableQuery import XRetryableQuery
from xpy3lib.XRetryableSave import XRetryableSave
from sicost.AbstractDPJob import AbstractDPJob
import sys, datetime, json, logging, os, time, math
import pandas as pd
import numpy as np
# import matplotlib.pyplot as plt
# import matplotlib as mpl
from numpy import array
import cvxpy as cp
from SKO.PSO import PSO
from xpy3lib.utils.XDataFrameUtils import XDataFrameUtils

class OptimalJob(AbstractDPJob):


    def __init__(self,
                 p_body_dict=None):


        super(OptimalJob, self).__init__(p_config=None,
                                        p_db_conn_mpp=None,
                                        p_db_conn_rds=None,
                                        p_db_conn_dbprod7=None,
                                        p_unit=None,
                                        p_account=None,
                                        p_cost_center=None,
                                        p_account_period_start=None,
                                        p_account_period_end=None)
        self.body_dict = p_body_dict

        pass


    def execute(self):
        return self.do_execute()


    def do_execute(self):

        super(OptimalJob, self).do_execute()
        # PSO的参数
        w = 0.8  # 惯性因子，一般取1
        c1 = 2  # 学习因子，一般取2
        c2 = 2  #
        dim = 20  # 维度的维度
        size = 100  # 种群大小，即种群中小鸟的个数
        iter_num = 10000  # 算法最大迭代次数
        max_vel = 0.5  # 限制粒子的最大速度




        """
        通过JSON传入参数
        """
        start = datetime.datetime.now()
        # path = './test_20221025.json'
        # with open(path, 'r') as f:
        #     row_data = json.load(f)
        # if (row_data is None):
        #     sys.exit(1)
        row_data = self.body_dict
        price_lianjiaomei = row_data['price_lianjiaomei']
        # price_gaolulantan = row_data['price_gaolulantan']
        kongmeizhibiao = row_data['kongmeizhibiao']
        tieshuichanliang = row_data['tieshuichanliang']
        jiaotanchanliang = row_data['jiaotanchanliang']
        fadianliang = row_data['fadianliang']
        shaojiechanliang = row_data['shaojiechanliang']
        zongmeibi = row_data['zongmeibi']
        zongjiaobi = row_data['zongjiaobi']
        shaojieranliaobi = row_data['shaojieranliaobi']
        chengjiaolv = row_data['chengjiaolv']
        yejinjiaolv = row_data['yejinjiaolv']
        cujiaolv = row_data['cujiaolv']
        meidianbi = row_data['meidianbi']
        fadianmeihao = row_data['fadianmeihao']
        lianjiaomeishuifen = row_data['lianjiaomeishuifen']
        penchuimeishuifen = row_data['penchuimeishuifen']
        shaojiemeishuifen = row_data['shaojiemeishuifen']
        CDQbi = row_data['CDQbi']
        meitanwushunlv = row_data['meitankuisunlv']
        waigoujiaoshuifen = row_data['waigoujiaoshuifen']
        waigoujiaofenlv = row_data['waigoujiaofenlv']
        shaojiejiaofenshuifen = row_data['shaojiejiaofenshuifen']
        lantanshuifen = row_data['lantanshuifen']
        jiaotanchaochanlv = row_data['jiaotanchaochanlv']
        chunmeibi = zongmeibi - CDQbi
        shenfu_penchui_price = row_data['shenfu_penchui_price']
        eluosi_penchui_price = row_data['eluosi_penchui_price']
        yongxia_penchui_price = row_data['yongxia_penchui_price']
        yongcheng_penchui_price = row_data['yongcheng_penchui_price']
        changcun_penchui_price = row_data['changcun_penchui_price']
        gaoping_penchui_price = row_data['gaoping_penchui_price']
        zhaozhuang_penchui_price = row_data['zhaozhuang_penchui_price']
        yangquan2_penchui_price = row_data['yangquan2_penchui_price']
        shenfu_penchui_kegongziyuan = row_data['shenfu_penchui_kegongziyuan']
        eluosi_penchui_kegongziyuan = row_data['eluosi_penchui_kegongziyuan']
        yongxia_penchui_kegongziyuan = row_data['yongxia_penchui_kegongziyuan']
        yongcheng_penchui_kegongziyuan = row_data['yongcheng_penchui_kegongziyuan']
        changcun_penchui_kegongziyuan = row_data['changcun_penchui_kegongziyuan']
        gaoping_zhaozhuang_yangquan2_penchui_kegongziyuan = row_data['gaoping_zhaozhuang_yangquan2_penchui_kegongziyuan']
        # gaolulantan_penchui_kegongziyuan = row_data['gaolulantan_penchui_kegongziyuan']
        # shenfu_penchui_rezhi = row_data['shenfu_penchui_rezhi']
        # eluosi_penchui_rezhi = row_data['eluosi_penchui_rezhi']
        # yongxia_penchui_rezhi = row_data['yongxia_penchui_rezhi']
        # yongcheng_penchui_rezhi = row_data['yongcheng_penchui_rezhi']
        # changcun_penchui_rezhi = row_data['changcun_penchui_rezhi']
        # gaoping_penchui_rezhi = row_data['gaoping_penchui_rezhi']
        # zhaozhuang_penchui_rezhi = row_data['zhaozhuang_penchui_rezhi']
        # yangquan2_penchui_rezhi = row_data['yangquan2_penchui_rezhi']
        # penchui_rezhi_min = row_data['penchui_rezhi_min']
        datongpeiQ5800_fadian_price = row_data['datongpeiQ5800_fadian_price']
        datongpeiQ5500_fadian_price = row_data['datongpeiQ5500_fadian_price']
        datongpeiQ5200_fadian_price = row_data['datongpeiQ5200_fadian_price']
        datongpeiQ5000_fadian_price = row_data['datongpeiQ5000_fadian_price']
        shenfuyuan_fadian_price = row_data['shenfuyuan_fadian_price']
        shenfupei_fadian_price = row_data['shenfupei_fadian_price']
        shenyou2_fadian_price = row_data['shenyou2_fadian_price']
        shenwai3_fadian_price = row_data['shenwai3_fadian_price']
        dianchanglantan_fadian_price = row_data['dianchanglantan_fadian_price']
        price_dianchanglantan = dianchanglantan_fadian_price
        # datongpeiQ5800_fadian_rezhi = row_data['datongpeiQ5800_fadian_rezhi']
        # datongpeiQ5500_fadian_rezhi = row_data['datongpeiQ5500_fadian_rezhi']
        # datongpeiQ5200_fadian_rezhi = row_data['datongpeiQ5200_fadian_rezhi']
        # datongpeiQ5000_fadian_rezhi = row_data['datongpeiQ5000_fadian_rezhi']
        # shenfuyuan_fadian_rezhi = row_data['shenfuyuan_fadian_rezhi']
        # shenfupei_fadian_rezhi = row_data['shenfupei_fadian_rezhi']
        # shenyou2_fadian_rezhi = row_data['shenyou2_fadian_rezhi']
        # shenwai3_fadian_rezhi = row_data['shenwai3_fadian_rezhi']
        # fadian_rezhi_min = row_data['fadian_rezhi_min']
        datongpeiQ5800_fadian_kegongziyuan = row_data['datongpeiQ5800_fadian_kegongziyuan']
        datongpeiQ5500_fadian_kegongziyuan = row_data['datongpeiQ5500_fadian_kegongziyuan']
        datongpeiQ5200_fadian_kegongziyuan = row_data['datongpeiQ5200_fadian_kegongziyuan']
        datongpeiQ5000_fadian_kegongziyuan = row_data['datongpeiQ5000_fadian_kegongziyuan']
        shenfuyuan_fadian_kegongziyuan = row_data['shenfuyuan_fadian_kegongziyuan']
        shenfupei_fadian_kegongziyuan = row_data['shenfupei_fadian_kegongziyuan']
        waigoujiaofen_shaojie_price = row_data['waigoujiaofen_shaojie_price']
        jiaozuo_shaojie_price = row_data['jiaozuo_shaojie_price']
        jincheng_shaojie_price = row_data['jincheng_shaojie_price']
        shaojielantan_shaojie_price = row_data['shaojielantan_shaojie_price']
        price_waigoujiaotan = waigoujiaofen_shaojie_price
        price_shaojiejiaofen = shaojielantan_shaojie_price
        # jiaozuo_shaojie_rezhi = row_data['jiaozuo_shaojie_rezhi']
        # jincheng_shaojie_rezhi = row_data['jincheng_shaojie_rezhi']
        # shaojie_rizhi_min = row_data['shaojie_rizhi_min']
        jiaozuo_shaojie_kegongziyuan = row_data['jiaozuo_shaojie_kegongziyuan']
        jincheng_shaojie_kegongziyuan = row_data['jincheng_shaojie_kegongziyuan']
        shaojielantan_shaojie_kegongziyuan = row_data['shaojielantan_shaojie_kegongziyuan']
        gaizhilantan_penchui_price = row_data['gaizhilantan_penchui_price']
        tizhijiaofen_penchui_price = row_data['tizhijiaofen_penchui_price']
        dingzhilantan_penchui_price = row_data['dingzhilantan_penchui_price']
        gaizhilantan_penchui_kegongziyuan = row_data['gaizhilantan_penchui_kegongziyuan']
        tizhijiaofen_penchui_kegongziyuan = row_data['tizhijiaofen_penchui_kegongziyuan']
        dingzhilantan_penchui_kegongziyuan = row_data['dingzhilantan_penchui_kegongziyuan']
        # 计算量
        # 喷吹煤
        CAL_WT_penchuimei = tieshuichanliang * chunmeibi / 1000 / (100 - penchuimeishuifen) * 100 * (100 + meitanwushunlv) / 100
        # 炼焦煤
        CAL_WT_lianjiaomei = jiaotanchanliang / chengjiaolv * 100 / (100 - lianjiaomeishuifen) * 100 * (100 + meitanwushunlv) / 100
        WT_lianjiaomei = CAL_WT_lianjiaomei * (100 + jiaotanchaochanlv) / 100

        # 发电煤
        CAL_WT_fadianmei = fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100
        # 烧结煤
        CAL_WT_shaojiemei = (shaojiechanliang * shaojieranliaobi / 1000 - jiaotanchanliang * cujiaolv / 100) / (100 - shaojiemeishuifen) * 100 * (100 + meitanwushunlv) / 100
        # 外购焦炭    （补炼焦煤）
        WT_waigoujiaotan = (tieshuichanliang * zongjiaobi / 1000 - jiaotanchanliang * yejinjiaolv / 100) / (100 - waigoujiaofenlv) * 100 / (100 - waigoujiaoshuifen) * 100
        p_max_constant = 100000
        pm1_shui = row_data['pm1_shui']
        pm2_shui = row_data['pm2_shui']
        pm3_shui = row_data['pm3_shui']
        pm4_shui = row_data['pm4_shui']
        pm5_shui = row_data['pm5_shui']
        pm6_shui = row_data['pm6_shui']
        pm7_shui = row_data['pm7_shui']
        pm8_shui = row_data['pm8_shui']
        pl1_shui = row_data['pl1_shui']
        pl2_shui = row_data['pl2_shui']
        pl3_shui = row_data['pl3_shui']
        p_shui_max = row_data['p_shui_max']
        p_shui_min = row_data['p_shui_min']
        pm1_hui = row_data['pm1_hui']
        pm2_hui = row_data['pm2_hui']
        pm3_hui = row_data['pm3_hui']
        pm4_hui = row_data['pm4_hui']
        pm5_hui = row_data['pm5_hui']
        pm6_hui = row_data['pm6_hui']
        pm7_hui = row_data['pm7_hui']
        pm8_hui = row_data['pm8_hui']
        pl1_hui = row_data['pl1_hui']
        pl2_hui = row_data['pl2_hui']
        pl3_hui = row_data['pl3_hui']
        p_hui_max = row_data['p_hui_max']
        p_hui_min = row_data['p_hui_min']
        pm1_huifa = row_data['pm1_huifa']
        pm2_huifa = row_data['pm2_huifa']
        pm3_huifa = row_data['pm3_huifa']
        pm4_huifa = row_data['pm4_huifa']
        pm5_huifa = row_data['pm5_huifa']
        pm6_huifa = row_data['pm6_huifa']
        pm7_huifa = row_data['pm7_huifa']
        pm8_huifa = row_data['pm8_huifa']
        pl1_huifa = row_data['pl1_huifa']
        pl2_huifa = row_data['pl2_huifa']
        pl3_huifa = row_data['pl3_huifa']
        p_huifa_max = row_data['p_huifa_max']
        p_huifa_min = row_data['p_huifa_min']
        pm1_liu = row_data['pm1_liu']
        pm2_liu = row_data['pm2_liu']
        pm3_liu = row_data['pm3_liu']
        pm4_liu = row_data['pm4_liu']
        pm5_liu = row_data['pm5_liu']
        pm6_liu = row_data['pm6_liu']
        pm7_liu = row_data['pm7_liu']
        pm8_liu = row_data['pm8_liu']
        pl1_liu = row_data['pl1_liu']
        pl2_liu = row_data['pl2_liu']
        pl3_liu = row_data['pl3_liu']
        p_liu_max = row_data['p_liu_max']
        p_liu_min = row_data['p_liu_min']
        pm1_gu = row_data['pm1_gu']
        pm2_gu = row_data['pm2_gu']
        pm3_gu = row_data['pm3_gu']
        pm4_gu = row_data['pm4_gu']
        pm5_gu = row_data['pm5_gu']
        pm6_gu = row_data['pm6_gu']
        pm7_gu = row_data['pm7_gu']
        pm8_gu = row_data['pm8_gu']
        pl1_gu = row_data['pl1_gu']
        pl2_gu = row_data['pl2_gu']
        pl3_gu = row_data['pl3_gu']
        p_gu_max = row_data['p_gu_max']
        # 改了
        p_gu_min = row_data['p_gu_min']
        pm1_mo = row_data['pm1_mo']
        pm2_mo = row_data['pm2_mo']
        pm3_mo = row_data['pm3_mo']
        pm4_mo = row_data['pm4_mo']
        pm5_mo = row_data['pm5_mo']
        pm6_mo = row_data['pm6_mo']
        pm7_mo = row_data['pm7_mo']
        pm8_mo = row_data['pm8_mo']
        pl1_mo = row_data['pl1_mo']
        pl2_mo = row_data['pl2_mo']
        pl3_mo = row_data['pl3_mo']
        p_mo_max = row_data['p_mo_max']
        p_mo_min = row_data['p_mo_min']
        pm1_re = row_data['pm1_re']
        pm2_re = row_data['pm2_re']
        pm3_re = row_data['pm3_re']
        pm4_re = row_data['pm4_re']
        pm5_re = row_data['pm5_re']
        pm6_re = row_data['pm6_re']
        pm7_re = row_data['pm7_re']
        pm8_re = row_data['pm8_re']
        pl1_re = row_data['pl1_re']
        pl2_re = row_data['pl2_re']
        pl3_re = row_data['pl3_re']
        p_re_max = row_data['p_re_max']
        p_re_min = row_data['p_re_min']
        pm1_c = row_data['pm1_c']
        pm2_c = row_data['pm2_c']
        pm3_c = row_data['pm3_c']
        pm4_c = row_data['pm4_c']
        pm5_c = row_data['pm5_c']
        pm6_c = row_data['pm6_c']
        pm7_c = row_data['pm7_c']
        pm8_c = row_data['pm8_c']
        pl1_c = row_data['pl1_c']
        pl2_c = row_data['pl2_c']
        pl3_c = row_data['pl3_c']
        p_c_max = row_data['p_c_max']
        p_c_min = row_data['p_c_min']

        dm1_shui = row_data['dm1_shui']
        dm2_shui = row_data['dm2_shui']
        dm3_shui = row_data['dm3_shui']
        dm4_shui = row_data['dm4_shui']
        dm5_shui = row_data['dm5_shui']
        dm6_shui = row_data['dm6_shui']
        dl1_shui = row_data['dl1_shui']
        # 改了
        d_shui_max = row_data['d_shui_max']
        d_shui_min = row_data['d_shui_min']
        dm1_hui = row_data['dm1_hui']
        dm2_hui = row_data['dm2_hui']
        dm3_hui = row_data['dm3_hui']
        dm4_hui = row_data['dm4_hui']
        dm5_hui = row_data['dm5_hui']
        dm6_hui = row_data['dm6_hui']
        dl1_hui = row_data['dl1_hui']
        d_hui_max = row_data['d_hui_max']
        d_hui_min = row_data['d_hui_min']
        dm1_huifa = row_data['dm1_huifa']
        dm2_huifa = row_data['dm2_huifa']
        dm3_huifa = row_data['dm3_huifa']
        dm4_huifa = row_data['dm4_huifa']
        dm5_huifa = row_data['dm5_huifa']
        dm6_huifa = row_data['dm6_huifa']
        dl1_huifa = row_data['dl1_huifa']
        d_huifa_max = row_data['d_huifa_max']
        d_huifa_min = row_data['d_huifa_min']
        dm1_liu = row_data['dm1_liu']
        dm2_liu = row_data['dm2_liu']
        dm3_liu = row_data['dm3_liu']
        dm4_liu = row_data['dm4_liu']
        dm5_liu = row_data['dm5_liu']
        dm6_liu = row_data['dm6_liu']
        dl1_liu = row_data['dl1_liu']
        d_liu_max = row_data['d_liu_max']
        d_liu_min = row_data['d_liu_min']
        dm1_gu = row_data['dm1_gu']
        dm2_gu = row_data['dm2_gu']
        dm3_gu = row_data['dm3_gu']
        dm4_gu = row_data['dm4_gu']
        dm5_gu = row_data['dm5_gu']
        dm6_gu = row_data['dm6_gu']
        dl1_gu = row_data['dl1_gu']
        d_gu_max = row_data['d_gu_max']
        d_gu_min = row_data['d_gu_min']
        dm1_re = row_data['dm1_re']
        dm2_re = row_data['dm2_re']
        dm3_re = row_data['dm3_re']
        dm4_re = row_data['dm4_re']
        dm5_re = row_data['dm5_re']
        dm6_re = row_data['dm6_re']
        dm7_re = row_data['dm7_re']
        dm8_re = row_data['dm8_re']
        dl1_re = row_data['dl1_re']
        d_re_max = row_data['d_re_max']
        d_re_min = row_data['d_re_min']
        dm1_c = row_data['dm1_c']
        dm2_c = row_data['dm2_c']
        dm3_c = row_data['dm3_c']
        dm4_c = row_data['dm4_c']
        dm5_c = row_data['dm5_c']
        dm6_c = row_data['dm6_c']
        dl1_c = row_data['dl1_c']
        d_c_max = row_data['d_c_max']
        d_c_min = row_data['d_c_min']

        sm1_shui = row_data['sm1_shui']
        sm2_shui = row_data['sm2_shui']
        sl1_shui = row_data['sl1_shui']

        s_shui_max = row_data['s_shui_max']
        s_shui_min = row_data['s_shui_min']
        sm1_hui = row_data['sm1_hui']
        sm2_hui = row_data['sm2_hui']
        sl1_hui = row_data['sl1_hui']

        s_hui_max = row_data['s_hui_max']
        s_hui_min = row_data['s_hui_min']
        sm1_huifa = row_data['sm1_huifa']
        sm2_huifa = row_data['sm2_huifa']
        sl1_huifa = row_data['sl1_huifa']
        # 改了
        s_huifa_max = row_data['s_huifa_max']
        s_huifa_min = row_data['s_huifa_min']
        sm1_liu = row_data['sm1_liu']
        sm2_liu = row_data['sm2_liu']
        sl1_liu = row_data['sl1_liu']

        s_liu_max = row_data['s_liu_max']
        s_liu_min = row_data['s_liu_min']
        sm1_gu = row_data['sm1_gu']
        sm2_gu = row_data['sm2_gu']
        sl1_gu = row_data['sl1_gu']

        s_gu_max = row_data['s_gu_max']
        s_gu_min = row_data['s_gu_min']
        sm1_mo = row_data['sm1_mo']
        sm2_mo = row_data['sm2_mo']
        sl1_mo = row_data['sl1_mo']

        s_mo_max = row_data['s_mo_max']
        s_mo_min = row_data['s_mo_min']
        sm1_re = row_data['sm1_re']
        sm2_re = row_data['sm2_re']
        sl1_re = row_data['sl1_re']

        s_re_max = row_data['s_re_max']
        s_re_min = row_data['s_re_min']
        sm1_c = row_data['sm1_c']
        sm2_c = row_data['sm2_c']
        sl1_c = row_data['sl1_c']

        s_c_max = row_data['s_c_max']
        s_c_min = row_data['s_c_min']

        p1_1_ratio_min = row_data['p1_1_ratio_min']
        p1_1_ratio_max = row_data['p1_1_ratio_max']
        p_1_ratio_min = row_data['p_1_ratio_min']
        p_1_ratio_max = row_data['p_1_ratio_max']
        p2_2_ratio_min = row_data['p2_2_ratio_min']
        p2_2_ratio_max = row_data['p2_2_ratio_max']
        p3_2_ratio_min = row_data['p3_2_ratio_min']
        p3_2_ratio_max = row_data['p3_2_ratio_max']
        p4_2_ratio_min = row_data['p4_2_ratio_min']
        p4_2_ratio_max = row_data['p4_2_ratio_max']
        p5_2_ratio_min = row_data['p5_2_ratio_min']
        p5_2_ratio_max = row_data['p5_2_ratio_max']
        p6_2_ratio_min = row_data['p6_2_ratio_min']
        p6_2_ratio_max = row_data['p6_2_ratio_max']
        p7_2_ratio_min = row_data['p7_2_ratio_min']
        p7_2_ratio_max = row_data['p7_2_ratio_max']
        p8_2_ratio_min = row_data['p8_2_ratio_min']
        p8_2_ratio_max = row_data['p8_2_ratio_max']
        p_2_ratio_min = row_data['p_2_ratio_min']
        p_2_ratio_max = row_data['p_2_ratio_max']
        p9_3_ratio_min = row_data['p9_3_ratio_min']
        p9_3_ratio_max = row_data['p9_3_ratio_max']
        p10_3_ratio_min = row_data['p10_3_ratio_min']
        p10_3_ratio_max = row_data['p10_3_ratio_max']
        p11_3_ratio_min = row_data['p11_3_ratio_min']
        p11_3_ratio_max = row_data['p_3_ratio_min']
        p_3_ratio_min = row_data['p_3_ratio_min']
        p_3_ratio_max = row_data['p_3_ratio_max']

        d1_1_ratio_min = row_data['d1_1_ratio_min']
        d1_1_ratio_max = row_data['d1_1_ratio_max']
        d2_1_ratio_min = row_data['d2_1_ratio_min']
        d2_1_ratio_max = row_data['d2_1_ratio_max']
        d3_1_ratio_min = row_data['d3_1_ratio_min']
        d3_1_ratio_max = row_data['d3_1_ratio_max']
        d4_1_ratio_min = row_data['d4_1_ratio_min']
        d4_1_ratio_max = row_data['d4_1_ratio_max']
        d_1_ratio_min = row_data['d_1_ratio_min']
        d_1_ratio_max = row_data['d_1_ratio_max']
        d5_2_ratio_min = row_data['d5_2_ratio_min']
        d5_2_ratio_max = row_data['d5_2_ratio_max']
        d6_2_ratio_min = row_data['d6_2_ratio_min']
        d6_2_ratio_max = row_data['d6_2_ratio_max']
        d7_2_ratio_min = row_data['d7_2_ratio_min']
        d7_2_ratio_max = row_data['d7_2_ratio_max']
        d8_2_ratio_min = row_data['d8_2_ratio_min']
        d8_2_ratio_max = row_data['d8_2_ratio_max']
        d_2_ratio_min = row_data['d_2_ratio_min']
        d_2_ratio_max = row_data['d_2_ratio_max']
        d9_3_ratio_min = row_data['d9_3_ratio_min']
        d9_3_ratio_max = row_data['d9_3_ratio_max']
        d_3_ratio_min = row_data['d_3_ratio_min']
        d_3_ratio_max = row_data['d_3_ratio_max']

        s1_1_ratio_min = row_data['s1_1_ratio_min']
        s1_1_ratio_max = row_data['s1_1_ratio_max']
        s2_1_ratio_min = row_data['s2_1_ratio_min']
        s2_1_ratio_max = row_data['s2_1_ratio_max']
        s_1_ratio_min = row_data['s_1_ratio_min']
        s_1_ratio_max = row_data['s_1_ratio_max']
        s3_2_ratio_min = row_data['s3_2_ratio_min']
        s3_2_ratio_max = row_data['s3_2_ratio_max']
        s_2_ratio_min = row_data['s_2_ratio_min']
        s_2_ratio_max = row_data['s_2_ratio_max']

        # c1 = price_penchuimei
        c11 = shenfu_penchui_price
        c12 = eluosi_penchui_price
        c13 = yongxia_penchui_price
        c14 = yongcheng_penchui_price
        c15 = changcun_penchui_price
        c16 = gaoping_penchui_price
        c17 = zhaozhuang_penchui_price
        c18 = yangquan2_penchui_price
        # c2 = price_fadianmei
        c21 = datongpeiQ5800_fadian_price
        c22 = datongpeiQ5500_fadian_price
        c23 = datongpeiQ5200_fadian_price
        c24 = datongpeiQ5000_fadian_price
        c25 = shenfuyuan_fadian_price
        c26 = shenfupei_fadian_price
        c27 = shenyou2_fadian_price
        c28 = shenwai3_fadian_price
        # c3 = price_shaojiemei
        c31 = jiaozuo_shaojie_price
        c32 = jincheng_shaojie_price
        # c33 = waigoujiaofen_shaojie_price
        # c4 高炉兰炭价格
        c41 = gaizhilantan_penchui_price
        c42 = tizhijiaofen_penchui_price
        c43 = dingzhilantan_penchui_price

        cc5 = price_dianchanglantan
        cc6 = price_shaojiejiaofen

        a11 = (100 - penchuimeishuifen) / 100 / (100 + meitanwushunlv) * 100
        a12 = (100 - lantanshuifen) / 100
        a21 = 100 / (100 + meitanwushunlv)
        a22 = 100 / (100 + meitanwushunlv)
        a31 = (100 - shaojiemeishuifen) / 100 / (100 + meitanwushunlv) * 100
        a32 = (100 - shaojiejiaofenshuifen) / 100
        b0 = kongmeizhibiao - WT_lianjiaomei
        b1 = tieshuichanliang * chunmeibi / 1000
        b2 = fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100
        b3 = shaojiechanliang * shaojieranliaobi / 1000 - jiaotanchanliang * cujiaolv / 100 - WT_waigoujiaotan * waigoujiaofenlv / 100 * (
                100 - waigoujiaoshuifen) / 100
        b011 = shenfu_penchui_kegongziyuan
        b012 = eluosi_penchui_kegongziyuan
        b013 = yongxia_penchui_kegongziyuan
        b014 = yongcheng_penchui_kegongziyuan
        b015 = changcun_penchui_kegongziyuan
        b01678 = gaoping_zhaozhuang_yangquan2_penchui_kegongziyuan

        b021 = datongpeiQ5800_fadian_kegongziyuan
        b022 = datongpeiQ5500_fadian_kegongziyuan
        b023 = datongpeiQ5200_fadian_kegongziyuan
        b024 = datongpeiQ5000_fadian_kegongziyuan
        b025 = shenfuyuan_fadian_kegongziyuan
        b026 = shenfupei_fadian_kegongziyuan

        b031 = jiaozuo_shaojie_kegongziyuan
        b032 = jincheng_shaojie_kegongziyuan



        b041 = gaizhilantan_penchui_kegongziyuan
        b042 = tizhijiaofen_penchui_kegongziyuan
        b043 = dingzhilantan_penchui_kegongziyuan
        b06 = shaojielantan_shaojie_kegongziyuan

        br1 = 0
        br2 = 0
        br3 = 0
        #
        c = array([c11, c12, c13, c14, c15, c16, c17, c18, c21, c22, c23, c24, c25, c26, c27, c28, c31, c32, c41, c42, c43, cc5,
                   cc6])
        e1 = array([[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0],
                    # [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                    # [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                    # [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                    # [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                    # [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                    # [0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                    # [0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                    # [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                    # [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                    # [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                    # [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                    # [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                    # [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0],
                    # [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0],
                    # [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0],
                    # [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0],
                    # [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
                    # [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
                    [pm1_shui-p_shui_max, pm2_shui-p_shui_max, pm3_shui-p_shui_max, pm4_shui-p_shui_max, pm5_shui-p_shui_max, pm6_shui-p_shui_max, pm7_shui-p_shui_max, pm8_shui-p_shui_max, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, pl1_shui-p_shui_max, pl2_shui-p_shui_max, pl3_shui-p_shui_max, 0, 0],
                    [p_shui_min-pm1_shui, p_shui_min-pm2_shui, p_shui_min-pm3_shui, p_shui_min-pm4_shui, p_shui_min-pm5_shui, p_shui_min-pm6_shui, p_shui_min-pm7_shui, p_shui_min-pm8_shui, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, p_shui_min-pl1_shui, p_shui_min-pl2_shui, p_shui_min-pl3_shui, 0, 0],
                    [pm1_hui - p_hui_max, pm2_hui - p_hui_max, pm3_hui - p_hui_max, pm4_hui - p_hui_max,
                     pm5_hui - p_hui_max, pm6_hui - p_hui_max, pm7_hui - p_hui_max, pm8_hui - p_hui_max, 0, 0, 0, 0,
                     0, 0, 0, 0, 0, 0, pl1_hui - p_hui_max, pl2_hui - p_hui_max, pl3_hui - p_hui_max, 0, 0],
                    [p_hui_min - pm1_hui, p_hui_min - pm2_hui, p_hui_min - pm3_hui, p_hui_min - pm4_hui,
                     p_hui_min - pm5_hui, p_hui_min - pm6_hui, p_hui_min - pm7_hui, p_hui_min - pm8_hui, 0, 0, 0, 0,
                     0, 0, 0, 0, 0, 0, p_hui_min - pl1_hui, p_hui_min - pl2_hui, p_hui_min - pl3_hui, 0, 0],
                    [pm1_huifa - p_huifa_max, pm2_huifa - p_huifa_max, pm3_huifa - p_huifa_max, pm4_huifa - p_huifa_max,
                     pm5_huifa - p_huifa_max, pm6_huifa - p_huifa_max, pm7_huifa - p_huifa_max, pm8_huifa - p_huifa_max, 0, 0, 0, 0,
                     0, 0, 0, 0, 0, 0, pl1_huifa - p_huifa_max, pl2_huifa - p_huifa_max, pl3_huifa - p_huifa_max, 0, 0],
                    [p_huifa_min - pm1_huifa, p_huifa_min - pm2_huifa, p_huifa_min - pm3_huifa, p_huifa_min - pm4_huifa,
                     p_huifa_min - pm5_huifa, p_huifa_min - pm6_huifa, p_huifa_min - pm7_huifa, p_huifa_min - pm8_huifa, 0, 0, 0, 0,
                     0, 0, 0, 0, 0, 0, p_huifa_min - pl1_huifa, p_huifa_min - pl2_huifa, p_huifa_min - pl3_huifa, 0, 0],
                    [pm1_liu - p_liu_max, pm2_liu - p_liu_max, pm3_liu - p_liu_max, pm4_liu - p_liu_max,
                     pm5_liu - p_liu_max, pm6_liu - p_liu_max, pm7_liu - p_liu_max, pm8_liu - p_liu_max, 0, 0, 0, 0,
                     0, 0, 0, 0, 0, 0, pl1_liu - p_liu_max, pl2_liu - p_liu_max, pl3_liu - p_liu_max, 0, 0],
                    [p_liu_min - pm1_liu, p_liu_min - pm2_liu, p_liu_min - pm3_liu, p_liu_min - pm4_liu,
                     p_liu_min - pm5_liu, p_liu_min - pm6_liu, p_liu_min - pm7_liu, p_liu_min - pm8_liu, 0, 0, 0, 0,
                     0, 0, 0, 0, 0, 0, p_liu_min - pl1_liu, p_liu_min - pl2_liu, p_liu_min - pl3_liu, 0, 0],
                    [pm1_gu - p_gu_max, pm2_gu - p_gu_max, pm3_gu - p_gu_max, pm4_gu - p_gu_max,
                     pm5_gu - p_gu_max, pm6_gu - p_gu_max, pm7_gu - p_gu_max, pm8_gu - p_gu_max, 0, 0, 0, 0,
                     0, 0, 0, 0, 0, 0, pl1_gu - p_gu_max, pl2_gu - p_gu_max, pl3_gu - p_gu_max, 0, 0],
                    [p_gu_min - pm1_gu, p_gu_min - pm2_gu, p_gu_min - pm3_gu, p_gu_min - pm4_gu,
                     p_gu_min - pm5_gu, p_gu_min - pm6_gu, p_gu_min - pm7_gu, p_gu_min - pm8_gu, 0, 0, 0, 0,
                     0, 0, 0, 0, 0, 0, p_gu_min - pl1_gu, p_gu_min - pl2_gu, p_gu_min - pl3_gu, 0, 0],
                    [pm1_mo - p_mo_max, pm2_mo - p_mo_max, pm3_mo - p_mo_max, pm4_mo - p_mo_max,
                     pm5_mo - p_mo_max, pm6_mo - p_mo_max, pm7_mo - p_mo_max, pm8_mo - p_mo_max, 0, 0, 0, 0,
                     0, 0, 0, 0, 0, 0, pl1_mo - p_mo_max, pl2_mo - p_mo_max, pl3_mo - p_mo_max, 0, 0],
                    [p_mo_min - pm1_mo, p_mo_min - pm2_mo, p_mo_min - pm3_mo, p_mo_min - pm4_mo,
                     p_mo_min - pm5_mo, p_mo_min - pm6_mo, p_mo_min - pm7_mo, p_mo_min - pm8_mo, 0, 0, 0, 0,
                     0, 0, 0, 0, 0, 0, p_mo_min - pl1_mo, p_mo_min - pl2_mo, p_mo_min - pl3_mo, 0, 0],
                    [pm1_re - p_re_max, pm2_re - p_re_max, pm3_re - p_re_max, pm4_re - p_re_max,
                     pm5_re - p_re_max, pm6_re - p_re_max, pm7_re - p_re_max, pm8_re - p_re_max, 0, 0, 0, 0,
                     0, 0, 0, 0, 0, 0, pl1_re - p_re_max, pl2_re - p_re_max, pl3_re - p_re_max, 0, 0],
                    [p_re_min - pm1_re, p_re_min - pm2_re, p_re_min - pm3_re, p_re_min - pm4_re,
                     p_re_min - pm5_re, p_re_min - pm6_re, p_re_min - pm7_re, p_re_min - pm8_re, 0, 0, 0, 0,
                     0, 0, 0, 0, 0, 0, p_re_min - pl1_re, p_re_min - pl2_re, p_re_min - pl3_re, 0, 0],
                    [pm1_c - p_c_max, pm2_c - p_c_max, pm3_c - p_c_max, pm4_c - p_c_max,
                     pm5_c - p_c_max, pm6_c - p_c_max, pm7_c - p_c_max, pm8_c - p_c_max, 0, 0, 0, 0,
                     0, 0, 0, 0, 0, 0, pl1_c - p_c_max, pl2_c - p_c_max, pl3_c - p_c_max, 0, 0],
                    [p_c_min - pm1_c, p_c_min - pm2_c, p_c_min - pm3_c, p_c_min - pm4_c,
                     p_c_min - pm5_c, p_c_min - pm6_c, p_c_min - pm7_c, p_c_min - pm8_c, 0, 0, 0, 0,
                     0, 0, 0, 0, 0, 0, p_c_min - pl1_c, p_c_min - pl2_c, p_c_min - pl3_c, 0, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     dm1_shui - d_shui_max, dm2_shui - d_shui_max, dm3_shui - d_shui_max, dm4_shui - d_shui_max,
                     dm5_shui - d_shui_max, dm6_shui - d_shui_max, 0, 0, 0, 0, 0, 0, 0, dl1_shui - d_shui_max, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     d_shui_min - dm1_shui, d_shui_min - dm2_shui, d_shui_min - dm3_shui, d_shui_min - dm4_shui,
                     d_shui_min - dm5_shui, d_shui_min - dm6_shui, 0, 0, 0, 0, 0, 0, 0, d_shui_min - dl1_shui, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     dm1_hui - d_hui_max, dm2_hui - d_hui_max, dm3_hui - d_hui_max, dm4_hui - d_hui_max,
                     dm5_hui - d_hui_max, dm6_hui - d_hui_max, 0, 0, 0, 0, 0, 0, 0, dl1_hui - d_hui_max, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     d_hui_min - dm1_hui, d_hui_min - dm2_hui, d_hui_min - dm3_hui, d_hui_min - dm4_hui,
                     d_hui_min - dm5_hui, d_hui_min - dm6_hui, 0, 0, 0, 0, 0, 0, 0, d_hui_min - dl1_hui, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     dm1_huifa - d_huifa_max, dm2_huifa - d_huifa_max, dm3_huifa - d_huifa_max, dm4_huifa - d_huifa_max,
                     dm5_huifa - d_huifa_max, dm6_huifa - d_huifa_max,  0, 0, 0, 0, 0, 0, 0, dl1_huifa - d_huifa_max, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     d_huifa_min - dm1_huifa, d_huifa_min - dm2_huifa, d_huifa_min - dm3_huifa, d_huifa_min - dm4_huifa,
                     d_huifa_min - dm5_huifa, d_huifa_min - dm6_huifa, 0, 0, 0, 0, 0, 0, 0, d_huifa_min - dl1_huifa, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     dm1_liu - d_liu_max, dm2_liu - d_liu_max, dm3_liu - d_liu_max, dm4_liu - d_liu_max,
                     dm5_liu - d_liu_max, dm6_liu - d_liu_max, 0, 0, 0, 0, 0, 0, 0, dl1_liu - d_liu_max, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     d_liu_min - dm1_liu, d_liu_min - dm2_liu, d_liu_min - dm3_liu, d_liu_min - dm4_liu,
                     d_liu_min - dm5_liu, d_liu_min - dm6_liu, 0, 0, 0, 0, 0, 0, 0, d_liu_min - dl1_liu, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     dm1_gu - d_gu_max, dm2_gu - d_gu_max, dm3_gu - d_gu_max, dm4_gu - d_gu_max,
                     dm5_gu - d_gu_max, dm6_gu - d_gu_max, 0, 0, 0, 0, 0, 0, 0, dl1_gu - d_gu_max, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     d_gu_min - dm1_gu, d_gu_min - dm2_gu, d_gu_min - dm3_gu, d_gu_min - dm4_gu,
                     d_gu_min - dm5_gu, d_gu_min - dm6_gu, 0, 0, 0, 0, 0, 0, 0, d_gu_min - dl1_gu, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     dm1_re - d_re_max, dm2_re - d_re_max, dm3_re - d_re_max, dm4_re - d_re_max,
                     dm5_re - d_re_max, dm6_re - d_re_max, dm7_re - d_re_max, dm8_re - d_re_max, 0, 0, 0, 0, 0, dl1_re - d_re_max, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     d_re_min - dm1_re, d_re_min - dm2_re, d_re_min - dm3_re, d_re_min - dm4_re,
                     d_re_min - dm5_re, d_re_min - dm6_re, d_re_min - dm7_re, d_re_min - dm8_re, 0, 0, 0, 0, 0, d_re_min - dl1_re, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     dm1_c - d_c_max, dm2_c - d_c_max, dm3_c - d_c_max, dm4_c - d_c_max,
                     dm5_c - d_c_max, dm6_c - d_c_max, 0, 0, 0, 0, 0, 0, 0, dl1_c - d_c_max, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     d_c_min - dm1_c, d_c_min - dm2_c, d_c_min - dm3_c, d_c_min - dm4_c,
                     d_c_min - dm5_c, d_c_min - dm6_c, 0, 0, 0, 0, 0, 0, 0, d_c_min - dl1_c, 0],
                    # [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                    #  sm1_shui - s_shui_max, sm2_shui - s_shui_max, 0, 0, 0, 0, sl1_shui - s_shui_max],
                    # [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                    #  s_shui_min - sm1_shui, s_shui_min - sm2_shui, 0, 0, 0, 0, s_shui_min - sl1_shui],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     sm1_hui - s_hui_max, sm2_hui - s_hui_max, 0, 0, 0, 0, sl1_hui - s_hui_max],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     s_hui_min - sm1_hui, s_hui_min - sm2_hui, 0, 0, 0, 0, s_hui_min - sl1_hui],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     sm1_huifa - s_huifa_max, sm2_huifa - s_huifa_max, 0, 0, 0, 0, sl1_huifa - s_huifa_max],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     s_huifa_min - sm1_huifa, s_huifa_min - sm2_huifa, 0, 0, 0, 0, s_huifa_min - sl1_huifa],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     sm1_liu - s_liu_max, sm2_liu - s_liu_max, 0, 0, 0, 0, sl1_liu - s_liu_max],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     s_liu_min - sm1_liu, s_liu_min - sm2_liu, 0, 0, 0, 0, s_liu_min - sl1_liu],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     sm1_gu - s_gu_max, sm2_gu - s_gu_max, 0, 0, 0, 0, sl1_gu - s_gu_max],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     s_gu_min - sm1_gu, s_gu_min - sm2_gu, 0, 0, 0, 0, s_gu_min - sl1_gu],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     sm1_mo - s_mo_max, sm2_mo - s_mo_max, 0, 0, 0, 0, sl1_mo - s_mo_max],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     s_mo_min - sm1_mo, s_mo_min - sm2_mo, 0, 0, 0, 0, s_mo_min - sl1_mo],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     sm1_re - s_re_max, sm2_re - s_re_max, 0, 0, 0, 0, sl1_re - s_re_max],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     s_re_min - sm1_re, s_re_min - sm2_re, 0, 0, 0, 0, s_re_min - sl1_re],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     sm1_c - s_c_max, sm2_c - s_c_max, 0, 0, 0, 0, sl1_c - s_c_max],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     s_c_min - sm1_c, s_c_min - sm2_c, 0, 0, 0, 0, s_c_min - sl1_c],
                    [100-p1_1_ratio_max, -p1_1_ratio_max, -p1_1_ratio_max, -p1_1_ratio_max,
                     -p1_1_ratio_max, -p1_1_ratio_max, -p1_1_ratio_max, -p1_1_ratio_max, 0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, -p1_1_ratio_max, -p1_1_ratio_max, -p1_1_ratio_max, 0, 0],
                    [p1_1_ratio_min - 100, p1_1_ratio_min, p1_1_ratio_min, p1_1_ratio_min,
                     p1_1_ratio_min, p1_1_ratio_min, p1_1_ratio_min, p1_1_ratio_min, 0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, p1_1_ratio_min, p1_1_ratio_min, p1_1_ratio_min, 0, 0],
                    [100 - p_1_ratio_max, -p_1_ratio_max, -p_1_ratio_max, -p_1_ratio_max,
                     -p_1_ratio_max, -p_1_ratio_max, -p_1_ratio_max, -p_1_ratio_max, 0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, -p_1_ratio_max, -p_1_ratio_max, -p_1_ratio_max, 0, 0],
                    [p_1_ratio_min - 100, p_1_ratio_min, p_1_ratio_min, p_1_ratio_min,
                     p_1_ratio_min, p_1_ratio_min, p_1_ratio_min, p_1_ratio_min, 0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, p_1_ratio_min, p_1_ratio_min, p_1_ratio_min, 0, 0],
                    [-p2_2_ratio_max, 100 - p2_2_ratio_max, -p2_2_ratio_max, -p2_2_ratio_max,
                     -p2_2_ratio_max, -p2_2_ratio_max, -p2_2_ratio_max, -p2_2_ratio_max, 0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, -p2_2_ratio_max, -p2_2_ratio_max, -p2_2_ratio_max, 0, 0],
                    [p2_2_ratio_min, p2_2_ratio_min - 100, p2_2_ratio_min, p2_2_ratio_min,
                     p2_2_ratio_min, p2_2_ratio_min, p2_2_ratio_min, p2_2_ratio_min, 0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, p2_2_ratio_min, p2_2_ratio_min, p2_2_ratio_min, 0, 0],
                    [-p3_2_ratio_max, -p3_2_ratio_max, 100 - p3_2_ratio_max, -p3_2_ratio_max,
                     -p3_2_ratio_max, -p3_2_ratio_max, -p3_2_ratio_max, -p3_2_ratio_max, 0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, -p3_2_ratio_max, -p3_2_ratio_max, -p3_2_ratio_max, 0, 0],
                    [p3_2_ratio_min, p3_2_ratio_min, p3_2_ratio_min - 100, p3_2_ratio_min,
                     p3_2_ratio_min, p3_2_ratio_min, p3_2_ratio_min, p3_2_ratio_min, 0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, p3_2_ratio_min, p3_2_ratio_min, p3_2_ratio_min, 0, 0],
                    [-p4_2_ratio_max, -p4_2_ratio_max, -p4_2_ratio_max, 100 - p4_2_ratio_max,
                     -p4_2_ratio_max, -p4_2_ratio_max, -p4_2_ratio_max, -p4_2_ratio_max, 0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, -p4_2_ratio_max, -p4_2_ratio_max, -p4_2_ratio_max, 0, 0],
                    [p4_2_ratio_min, p4_2_ratio_min, p4_2_ratio_min, p4_2_ratio_min - 100,
                     p4_2_ratio_min, p4_2_ratio_min, p4_2_ratio_min, p4_2_ratio_min, 0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, p4_2_ratio_min, p4_2_ratio_min, p4_2_ratio_min, 0, 0],
                    [-p5_2_ratio_max, -p5_2_ratio_max, -p5_2_ratio_max, -p5_2_ratio_max,
                     100 - p5_2_ratio_max, -p5_2_ratio_max, -p5_2_ratio_max, -p5_2_ratio_max, 0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, -p5_2_ratio_max, -p5_2_ratio_max, -p5_2_ratio_max, 0, 0],
                    [p5_2_ratio_min, p5_2_ratio_min, p5_2_ratio_min, p5_2_ratio_min,
                     p5_2_ratio_min - 100, p5_2_ratio_min, p5_2_ratio_min, p5_2_ratio_min, 0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, p5_2_ratio_min, p5_2_ratio_min, p5_2_ratio_min, 0, 0],
                    [-p6_2_ratio_max, -p6_2_ratio_max, -p6_2_ratio_max, -p6_2_ratio_max,
                     -p6_2_ratio_max, 100 - p6_2_ratio_max, -p6_2_ratio_max, -p6_2_ratio_max, 0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, -p6_2_ratio_max, -p6_2_ratio_max, -p6_2_ratio_max, 0, 0],
                    [p6_2_ratio_min, p6_2_ratio_min, p6_2_ratio_min, p6_2_ratio_min,
                     p6_2_ratio_min, p6_2_ratio_min - 100, p6_2_ratio_min, p6_2_ratio_min, 0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, p6_2_ratio_min, p6_2_ratio_min, p6_2_ratio_min, 0, 0],
                    [-p7_2_ratio_max, -p7_2_ratio_max, -p7_2_ratio_max, -p7_2_ratio_max,
                     -p7_2_ratio_max, -p7_2_ratio_max, 100 - p7_2_ratio_max, -p7_2_ratio_max, 0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, -p7_2_ratio_max, -p7_2_ratio_max, -p7_2_ratio_max, 0, 0],
                    [p7_2_ratio_min, p7_2_ratio_min, p7_2_ratio_min, p7_2_ratio_min,
                     p7_2_ratio_min, p7_2_ratio_min, p7_2_ratio_min - 100, p7_2_ratio_min, 0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, p7_2_ratio_min, p7_2_ratio_min, p7_2_ratio_min, 0, 0],
                    [-p8_2_ratio_max, -p8_2_ratio_max, -p8_2_ratio_max, -p8_2_ratio_max,
                     -p8_2_ratio_max, -p8_2_ratio_max, -p8_2_ratio_max, 100 - p8_2_ratio_max, 0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, -p8_2_ratio_max, -p8_2_ratio_max, -p8_2_ratio_max, 0, 0],
                    [p8_2_ratio_min, p8_2_ratio_min, p8_2_ratio_min, p8_2_ratio_min,
                     p8_2_ratio_min, p8_2_ratio_min, p8_2_ratio_min, p8_2_ratio_min - 100, 0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, p8_2_ratio_min, p8_2_ratio_min, p8_2_ratio_min, 0, 0],
                    [-p_2_ratio_max, 100 - p_2_ratio_max, 100 - p_2_ratio_max, 100 - p_2_ratio_max,
                     100 - p_2_ratio_max, 100 - p_2_ratio_max, 100 - p_2_ratio_max,100 - p_2_ratio_max, 0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, -p_2_ratio_max, -p_2_ratio_max, -p_2_ratio_max, 0, 0],
                    [p_2_ratio_min, p_2_ratio_min - 100, p_2_ratio_min - 100, p_2_ratio_min - 100,
                     p_2_ratio_min - 100, p_2_ratio_min - 100, p_2_ratio_min - 100, p_2_ratio_min - 100, 0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, p_2_ratio_min, p_2_ratio_min, p_2_ratio_min, 0, 0],
                    [-p9_3_ratio_max, -p9_3_ratio_max, -p9_3_ratio_max, -p9_3_ratio_max,
                     -p9_3_ratio_max, -p9_3_ratio_max, -p9_3_ratio_max, -p9_3_ratio_max, 0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, 100 - p9_3_ratio_max, -p9_3_ratio_max, -p9_3_ratio_max, 0, 0],
                    [p9_3_ratio_min, p9_3_ratio_min, p9_3_ratio_min, p9_3_ratio_min,
                     p9_3_ratio_min, p9_3_ratio_min, p9_3_ratio_min, p9_3_ratio_min, 0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, p9_3_ratio_min - 100, p9_3_ratio_min, p9_3_ratio_min, 0, 0],
                    [-p10_3_ratio_max, -p10_3_ratio_max, -p10_3_ratio_max, -p10_3_ratio_max,
                     -p10_3_ratio_max, -p10_3_ratio_max, -p10_3_ratio_max, -p10_3_ratio_max, 0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, -p10_3_ratio_max, 100 - p10_3_ratio_max, -p10_3_ratio_max, 0, 0],
                    [p10_3_ratio_min, p10_3_ratio_min, p10_3_ratio_min, p10_3_ratio_min,
                     p10_3_ratio_min, p10_3_ratio_min, p10_3_ratio_min, p10_3_ratio_min, 0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, p10_3_ratio_min, p10_3_ratio_min - 100, p10_3_ratio_min, 0, 0],
                    [-p11_3_ratio_max, -p11_3_ratio_max, -p11_3_ratio_max, -p11_3_ratio_max,
                     -p11_3_ratio_max, -p11_3_ratio_max, -p11_3_ratio_max, -p11_3_ratio_max, 0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, -p11_3_ratio_max, -p11_3_ratio_max, 100 - p11_3_ratio_max, 0, 0],
                    [p11_3_ratio_min, p11_3_ratio_min, p11_3_ratio_min, p11_3_ratio_min,
                     p11_3_ratio_min, p11_3_ratio_min, p11_3_ratio_min, p11_3_ratio_min, 0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, p11_3_ratio_min, p11_3_ratio_min, p11_3_ratio_min- 100, 0, 0],
                    [-p_3_ratio_max, -p_3_ratio_max, -p_3_ratio_max, -p_3_ratio_max,
                     -p_3_ratio_max, -p_3_ratio_max, -p_3_ratio_max, -p_3_ratio_max, 0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, 100 - p_3_ratio_max, 100 - p_3_ratio_max, 100 - p_3_ratio_max, 0, 0],
                    [p_3_ratio_min, p_3_ratio_min, p_3_ratio_min, p_3_ratio_min,
                     p_3_ratio_min, p_3_ratio_min, p_3_ratio_min, p_3_ratio_min, 0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, p_3_ratio_min - 100, p_3_ratio_min - 100, p_3_ratio_min - 100, 0, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     100 - d1_1_ratio_max, -d1_1_ratio_max, -d1_1_ratio_max, -d1_1_ratio_max,
                     -d1_1_ratio_max, -d1_1_ratio_max, -d1_1_ratio_max, -d1_1_ratio_max,
                     0, 0, 0, 0, 0, -d1_1_ratio_max, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     d1_1_ratio_min - 100, d1_1_ratio_min, d1_1_ratio_min, d1_1_ratio_min,
                     d1_1_ratio_min, d1_1_ratio_min, d1_1_ratio_min, d1_1_ratio_min,
                     0, 0, 0, 0, 0, d1_1_ratio_min, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     -d2_1_ratio_max, 100 - d2_1_ratio_max, -d2_1_ratio_max, -d2_1_ratio_max,
                     -d2_1_ratio_max, -d2_1_ratio_max, -d2_1_ratio_max, -d2_1_ratio_max,
                     0, 0, 0, 0, 0, -d2_1_ratio_max,  0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     d2_1_ratio_min, d2_1_ratio_min - 100, d2_1_ratio_min, d2_1_ratio_min,
                     d2_1_ratio_min, d2_1_ratio_min, d2_1_ratio_min, d2_1_ratio_min,
                     0, 0, 0, 0, 0, d2_1_ratio_min,  0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     -d3_1_ratio_max, -d3_1_ratio_max, 100 - d3_1_ratio_max, -d3_1_ratio_max,
                     -d3_1_ratio_max, -d3_1_ratio_max, -d3_1_ratio_max, -d3_1_ratio_max,
                     0, 0, 0, 0, 0, -d3_1_ratio_max,  0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     d3_1_ratio_min, d3_1_ratio_min, d3_1_ratio_min - 100, d3_1_ratio_min,
                     d3_1_ratio_min, d3_1_ratio_min, d3_1_ratio_min, d3_1_ratio_min,
                     0, 0, 0, 0, 0, d3_1_ratio_min, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     -d4_1_ratio_max, -d4_1_ratio_max, -d4_1_ratio_max, 100 - d4_1_ratio_max,
                     -d4_1_ratio_max, -d4_1_ratio_max, -d4_1_ratio_max, -d4_1_ratio_max,
                     0, 0, 0, 0, 0, -d4_1_ratio_max, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     d4_1_ratio_min, d4_1_ratio_min, d4_1_ratio_min, d4_1_ratio_min - 100,
                     d4_1_ratio_min, d4_1_ratio_min, d4_1_ratio_min, d4_1_ratio_min,
                     0, 0, 0, 0, 0, d4_1_ratio_min,  0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     100 - d_1_ratio_max, 100 - d_1_ratio_max, 100 - d_1_ratio_max, 100 - d_1_ratio_max,
                     -d_1_ratio_max, -d_1_ratio_max, -d_1_ratio_max, -d_1_ratio_max,
                     0, 0, 0, 0, 0, -d_1_ratio_max,  0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     d_1_ratio_min - 100, d_1_ratio_min - 100, d_1_ratio_min - 100, d_1_ratio_min - 100,
                     d_1_ratio_min, d_1_ratio_min, d_1_ratio_min, d_1_ratio_min,
                     0, 0, 0, 0, 0, d_1_ratio_min,  0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     -d5_2_ratio_max, -d5_2_ratio_max, -d5_2_ratio_max, -d5_2_ratio_max,
                     100 - d5_2_ratio_max, -d5_2_ratio_max, -d5_2_ratio_max, -d5_2_ratio_max,
                     0, 0, 0, 0, 0, -d5_2_ratio_max,  0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     d5_2_ratio_min, d5_2_ratio_min, d5_2_ratio_min, d5_2_ratio_min,
                     d5_2_ratio_min - 100, d5_2_ratio_min, d5_2_ratio_min, d5_2_ratio_min,
                     0, 0, 0, 0, 0, d5_2_ratio_min,  0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     -d6_2_ratio_max, -d6_2_ratio_max, -d6_2_ratio_max, -d6_2_ratio_max,
                     -d6_2_ratio_max, 100 - d6_2_ratio_max, -d6_2_ratio_max, -d6_2_ratio_max,
                     0, 0, 0, 0, 0, -d6_2_ratio_max, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     d6_2_ratio_min, d6_2_ratio_min, d6_2_ratio_min, d6_2_ratio_min,
                     d6_2_ratio_min, d6_2_ratio_min - 100, d6_2_ratio_min, d6_2_ratio_min,
                     0, 0, 0, 0, 0, d6_2_ratio_min, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     -d7_2_ratio_max, -d7_2_ratio_max, -d7_2_ratio_max, -d7_2_ratio_max,
                     -d7_2_ratio_max, -d7_2_ratio_max, 100 - d7_2_ratio_max, -d7_2_ratio_max,
                     0, 0, 0, 0, 0, -d7_2_ratio_max,  0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     d7_2_ratio_min, d7_2_ratio_min, d7_2_ratio_min, d7_2_ratio_min,
                     d7_2_ratio_min, d7_2_ratio_min, d7_2_ratio_min - 100, d7_2_ratio_min,
                     0, 0, 0, 0, 0, d7_2_ratio_min, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     -d8_2_ratio_max, -d8_2_ratio_max, -d8_2_ratio_max, -d8_2_ratio_max,
                     -d8_2_ratio_max, -d8_2_ratio_max, -d8_2_ratio_max, 100 - d8_2_ratio_max,
                     0, 0, 0, 0, 0, -d8_2_ratio_max, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     d8_2_ratio_min, d8_2_ratio_min, d8_2_ratio_min, d8_2_ratio_min,
                     d8_2_ratio_min, d8_2_ratio_min, d8_2_ratio_min, d8_2_ratio_min - 100,
                     0, 0, 0, 0, 0, d8_2_ratio_min, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     - d_2_ratio_max, -d_2_ratio_max, -d_2_ratio_max, -d_2_ratio_max,
                     100 - d_2_ratio_max, 100 - d_2_ratio_max, 100 - d_2_ratio_max, 100 - d_2_ratio_max,
                     0, 0, 0, 0, 0, -d_2_ratio_max, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     d_2_ratio_min, d_2_ratio_min, d_2_ratio_min, d_2_ratio_min,
                     d_2_ratio_min - 100, d_2_ratio_min - 100, d_2_ratio_min - 100, d_2_ratio_min - 100,
                     0, 0, 0, 0, 0, d_2_ratio_min, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     -d9_3_ratio_max, -d9_3_ratio_max, -d9_3_ratio_max, -d9_3_ratio_max,
                     -d9_3_ratio_max, -d9_3_ratio_max, -d9_3_ratio_max, -d9_3_ratio_max,
                     0, 0, 0, 0, 0, 100 - d9_3_ratio_max, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     d9_3_ratio_min, d9_3_ratio_min, d9_3_ratio_min, d9_3_ratio_min,
                     d9_3_ratio_min, d9_3_ratio_min, d9_3_ratio_min, d9_3_ratio_min,
                     0, 0, 0, 0, 0, d9_3_ratio_min - 100, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     -d_3_ratio_max, -d_3_ratio_max, -d_3_ratio_max, -d_3_ratio_max,
                     -d_3_ratio_max, -d_3_ratio_max, -d_3_ratio_max, -d_3_ratio_max,
                     0, 0, 0, 0, 0, 100 - d_3_ratio_max,  0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     d_3_ratio_min, d_3_ratio_min, d_3_ratio_min, d_3_ratio_min,
                     d_3_ratio_min, d_3_ratio_min, d_3_ratio_min, d_3_ratio_min,
                     0, 0, 0, 0, 0, d_3_ratio_min - 100, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     100 - s1_1_ratio_max, -s1_1_ratio_max,
                     0, 0, 0, 0, -s1_1_ratio_max],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     s1_1_ratio_min - 100, s1_1_ratio_min,
                     0, 0, 0, 0, s1_1_ratio_min],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     -s2_1_ratio_max, 100 - s2_1_ratio_max,
                     0, 0, 0, 0, -s2_1_ratio_max],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     s2_1_ratio_min, s2_1_ratio_min - 100,
                     0, 0, 0, 0, s2_1_ratio_min],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     100 - s_1_ratio_max, 100 - s_1_ratio_max,
                     0, 0, 0, 0, -s_1_ratio_max],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     s_1_ratio_min - 100, s_1_ratio_min - 100,
                     0, 0, 0, 0, s_1_ratio_min],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     -s3_2_ratio_max, -s3_2_ratio_max,
                     0, 0, 0, 0, 100 - s3_2_ratio_max],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     s3_2_ratio_min, s3_2_ratio_min,
                     0, 0, 0, 0, s3_2_ratio_min - 100],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     -s_2_ratio_max, -s_2_ratio_max,
                     0, 0, 0, 0, 100 - s_2_ratio_max],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     s_2_ratio_min, s_2_ratio_min,
                     0, 0, 0, 0, s_2_ratio_min - 100]
                    ])  # 定义小于等于不等式约束矩阵
        e2 = array([[a11, a11, a11, a11, a11, a11, a11, a11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a12, a12, a12, 0, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0, a21, a21, a21, a21, a21, a21, a21, a21, 0, 0, 0, 0, 0, a22, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a31, a31, 0, 0, 0, 0, a32]])  # 定义等式约束矩阵
        f1 = array(
            [b0,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
               , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
        f2 = array([b1, b2, b3])
        x = cp.Variable(23)
        obj = cp.Minimize(c @ x)
        cons = [e1 @ x <= f1, e2 @ x == f2, x >= 0]
        prob = cp.Problem(obj, cons)
        prob.solve(solver='GLPK_MI', verbose=True)
        print("最优初始值为:", prob.value)
        print("最优初始解为：\n", x.value)
        if x.value is None:
            success = 0
        else:
            success = 1
        print(success)


        Achushi_x11 = abs(x.value[0])
        Achushi_x12 = abs(x.value[1])
        Achushi_x13 = abs(x.value[2])
        Achushi_x14 = abs(x.value[3])
        Achushi_x15 = abs(x.value[4])
        Achushi_x16 = abs(x.value[5])
        Achushi_x17 = abs(x.value[6])
        Achushi_x18 = abs(x.value[7])
        Achushi_x21 = abs(x.value[8])
        Achushi_x22 = abs(x.value[9])
        Achushi_x23 = abs(x.value[10])
        Achushi_x24 = abs(x.value[11])
        Achushi_x25 = abs(x.value[12])
        Achushi_x26 = abs(x.value[13])
        Achushi_x27 = abs(x.value[14])
        Achushi_x28 = abs(x.value[15])
        Achushi_x31 = abs(x.value[16])
        Achushi_x32 = abs(x.value[17])
        Achushi_gaolu_gaizhi = abs(x.value[18])
        Achushi_gaolu_tizhi = abs(x.value[19])
        Achushi_gaolu_dingzhi = abs(x.value[20])
        Achushi_fadian = abs(x.value[21])
        Achushi_shaojie = abs(x.value[22])
        Achushi_z = Achushi_gaolu_gaizhi*c41 + Achushi_gaolu_tizhi*c42 + Achushi_gaolu_dingzhi*c43 + WT_waigoujiaotan * price_waigoujiaotan + WT_lianjiaomei * price_lianjiaomei + Achushi_fadian * price_dianchanglantan + Achushi_shaojie * price_shaojiejiaofen + Achushi_x11 * shenfu_penchui_price + Achushi_x12 * eluosi_penchui_price + Achushi_x13 * yongxia_penchui_price + Achushi_x14 * yongcheng_penchui_price + Achushi_x15 * changcun_penchui_price + Achushi_x16 * gaoping_penchui_price + Achushi_x17 * zhaozhuang_penchui_price + Achushi_x18 * yangquan2_penchui_price + Achushi_x21 * datongpeiQ5800_fadian_price + Achushi_x22 * datongpeiQ5500_fadian_price + Achushi_x23 * datongpeiQ5200_fadian_price + Achushi_x24 * datongpeiQ5000_fadian_price + Achushi_x25 * shenfuyuan_fadian_price + Achushi_x26 * shenfupei_fadian_price + Achushi_x27 * shenyou2_fadian_price + Achushi_x28 * shenwai3_fadian_price + Achushi_x31 * jiaozuo_shaojie_price + Achushi_x32 * jincheng_shaojie_price

        #









        c = array([c11, c12, c13, c14, c15, c16, c17, c18, c21, c22, c23, c24, c25, c26, c27, c28, c31, c32, c41, c42, c43, cc5,
                   cc6])
        e1 = array([[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0],
                    [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                    [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                    [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                    [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                    [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                    [0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
                    [pm1_shui-p_shui_max, pm2_shui-p_shui_max, pm3_shui-p_shui_max, pm4_shui-p_shui_max,
                     pm5_shui-p_shui_max, pm6_shui-p_shui_max, pm7_shui-p_shui_max, pm8_shui-p_shui_max,
                     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, pl1_shui-p_shui_max, pl2_shui-p_shui_max, pl3_shui-p_shui_max, 0, 0],
                    [p_shui_min-pm1_shui, p_shui_min-pm2_shui, p_shui_min-pm3_shui, p_shui_min-pm4_shui,
                     p_shui_min-pm5_shui, p_shui_min-pm6_shui, p_shui_min-pm7_shui, p_shui_min-pm8_shui,
                     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, p_shui_min-pl1_shui, p_shui_min-pl2_shui, p_shui_min-pl3_shui, 0, 0],
                    [pm1_hui - p_hui_max, pm2_hui - p_hui_max, pm3_hui - p_hui_max, pm4_hui - p_hui_max,
                     pm5_hui - p_hui_max, pm6_hui - p_hui_max, pm7_hui - p_hui_max, pm8_hui - p_hui_max, 0, 0, 0, 0,
                     0, 0, 0, 0, 0, 0, pl1_hui - p_hui_max, pl2_hui - p_hui_max, pl3_hui - p_hui_max, 0, 0],
                    [p_hui_min - pm1_hui, p_hui_min - pm2_hui, p_hui_min - pm3_hui, p_hui_min - pm4_hui,
                     p_hui_min - pm5_hui, p_hui_min - pm6_hui, p_hui_min - pm7_hui, p_hui_min - pm8_hui, 0, 0, 0, 0,
                     0, 0, 0, 0, 0, 0, p_hui_min - pl1_hui, p_hui_min - pl2_hui, p_hui_min - pl3_hui, 0, 0],
                    [pm1_huifa - p_huifa_max, pm2_huifa - p_huifa_max, pm3_huifa - p_huifa_max, pm4_huifa - p_huifa_max,
                     pm5_huifa - p_huifa_max, pm6_huifa - p_huifa_max, pm7_huifa - p_huifa_max, pm8_huifa - p_huifa_max,
                     0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     pl1_huifa - p_huifa_max, pl2_huifa - p_huifa_max, pl3_huifa - p_huifa_max, 0, 0],
                    [p_huifa_min - pm1_huifa, p_huifa_min - pm2_huifa, p_huifa_min - pm3_huifa, p_huifa_min - pm4_huifa,
                     p_huifa_min - pm5_huifa, p_huifa_min - pm6_huifa, p_huifa_min - pm7_huifa, p_huifa_min - pm8_huifa,
                     0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     p_huifa_min - pl1_huifa, p_huifa_min - pl2_huifa, p_huifa_min - pl3_huifa, 0, 0],
                    [pm1_liu - p_liu_max, pm2_liu - p_liu_max, pm3_liu - p_liu_max, pm4_liu - p_liu_max,
                     pm5_liu - p_liu_max, pm6_liu - p_liu_max, pm7_liu - p_liu_max, pm8_liu - p_liu_max,
                     0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     pl1_liu - p_liu_max, pl2_liu - p_liu_max, pl3_liu - p_liu_max, 0, 0],
                    [p_liu_min - pm1_liu, p_liu_min - pm2_liu, p_liu_min - pm3_liu, p_liu_min - pm4_liu,
                     p_liu_min - pm5_liu, p_liu_min - pm6_liu, p_liu_min - pm7_liu, p_liu_min - pm8_liu,
                     0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     p_liu_min - pl1_liu, p_liu_min - pl2_liu, p_liu_min - pl3_liu, 0, 0],
                    [pm1_gu - p_gu_max, pm2_gu - p_gu_max, pm3_gu - p_gu_max, pm4_gu - p_gu_max,
                     pm5_gu - p_gu_max, pm6_gu - p_gu_max, pm7_gu - p_gu_max, pm8_gu - p_gu_max,
                     0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     pl1_gu - p_gu_max, pl2_gu - p_gu_max, pl3_gu - p_gu_max, 0, 0],
                    [p_gu_min - pm1_gu, p_gu_min - pm2_gu, p_gu_min - pm3_gu, p_gu_min - pm4_gu,
                     p_gu_min - pm5_gu, p_gu_min - pm6_gu, p_gu_min - pm7_gu, p_gu_min - pm8_gu,
                     0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     p_gu_min - pl1_gu, p_gu_min - pl2_gu, p_gu_min - pl3_gu, 0, 0],
                    [pm1_mo - p_mo_max, pm2_mo - p_mo_max, pm3_mo - p_mo_max, pm4_mo - p_mo_max,
                     pm5_mo - p_mo_max, pm6_mo - p_mo_max, pm7_mo - p_mo_max, pm8_mo - p_mo_max,
                     0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     pl1_mo - p_mo_max, pl2_mo - p_mo_max, pl3_mo - p_mo_max, 0, 0],
                    [p_mo_min - pm1_mo, p_mo_min - pm2_mo, p_mo_min - pm3_mo, p_mo_min - pm4_mo,
                     p_mo_min - pm5_mo, p_mo_min - pm6_mo, p_mo_min - pm7_mo, p_mo_min - pm8_mo,
                     0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     p_mo_min - pl1_mo, p_mo_min - pl2_mo, p_mo_min - pl3_mo, 0, 0],
                    [pm1_re - p_re_max, pm2_re - p_re_max, pm3_re - p_re_max, pm4_re - p_re_max,
                     pm5_re - p_re_max, pm6_re - p_re_max, pm7_re - p_re_max, pm8_re - p_re_max,
                     0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     pl1_re - p_re_max, pl2_re - p_re_max, pl3_re - p_re_max, 0, 0],
                    [p_re_min - pm1_re, p_re_min - pm2_re, p_re_min - pm3_re, p_re_min - pm4_re,
                     p_re_min - pm5_re, p_re_min - pm6_re, p_re_min - pm7_re, p_re_min - pm8_re,
                     0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     p_re_min - pl1_re, p_re_min - pl2_re, p_re_min - pl3_re, 0, 0],
                    [pm1_c - p_c_max, pm2_c - p_c_max, pm3_c - p_c_max, pm4_c - p_c_max,
                     pm5_c - p_c_max, pm6_c - p_c_max, pm7_c - p_c_max, pm8_c - p_c_max,
                     0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     pl1_c - p_c_max, pl2_c - p_c_max, pl3_c - p_c_max, 0, 0],
                    [p_c_min - pm1_c, p_c_min - pm2_c, p_c_min - pm3_c, p_c_min - pm4_c,
                     p_c_min - pm5_c, p_c_min - pm6_c, p_c_min - pm7_c, p_c_min - pm8_c,
                     0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     p_c_min - pl1_c, p_c_min - pl2_c, p_c_min - pl3_c, 0, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     dm1_shui - d_shui_max, dm2_shui - d_shui_max, dm3_shui - d_shui_max, dm4_shui - d_shui_max,
                     dm5_shui - d_shui_max, dm6_shui - d_shui_max, 0, 0, 0, 0, 0, 0, 0, dl1_shui - d_shui_max, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     d_shui_min - dm1_shui, d_shui_min - dm2_shui, d_shui_min - dm3_shui, d_shui_min - dm4_shui,
                     d_shui_min - dm5_shui, d_shui_min - dm6_shui, 0, 0, 0, 0, 0, 0, 0, d_shui_min - dl1_shui, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     dm1_hui - d_hui_max, dm2_hui - d_hui_max, dm3_hui - d_hui_max, dm4_hui - d_hui_max,
                     dm5_hui - d_hui_max, dm6_hui - d_hui_max, 0, 0, 0, 0, 0, 0, 0, dl1_hui - d_hui_max, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     d_hui_min - dm1_hui, d_hui_min - dm2_hui, d_hui_min - dm3_hui, d_hui_min - dm4_hui,
                     d_hui_min - dm5_hui, d_hui_min - dm6_hui, 0, 0, 0, 0, 0, 0, 0, d_hui_min - dl1_hui, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     dm1_huifa - d_huifa_max, dm2_huifa - d_huifa_max, dm3_huifa - d_huifa_max, dm4_huifa - d_huifa_max,
                     dm5_huifa - d_huifa_max, dm6_huifa - d_huifa_max,  0, 0, 0, 0, 0, 0, 0, dl1_huifa - d_huifa_max, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     d_huifa_min - dm1_huifa, d_huifa_min - dm2_huifa, d_huifa_min - dm3_huifa, d_huifa_min - dm4_huifa,
                     d_huifa_min - dm5_huifa, d_huifa_min - dm6_huifa, 0, 0, 0, 0, 0, 0, 0, d_huifa_min - dl1_huifa, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     dm1_liu - d_liu_max, dm2_liu - d_liu_max, dm3_liu - d_liu_max, dm4_liu - d_liu_max,
                     dm5_liu - d_liu_max, dm6_liu - d_liu_max, 0, 0, 0, 0, 0, 0, 0, dl1_liu - d_liu_max, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     d_liu_min - dm1_liu, d_liu_min - dm2_liu, d_liu_min - dm3_liu, d_liu_min - dm4_liu,
                     d_liu_min - dm5_liu, d_liu_min - dm6_liu, 0, 0, 0, 0, 0, 0, 0, d_liu_min - dl1_liu, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     dm1_gu - d_gu_max, dm2_gu - d_gu_max, dm3_gu - d_gu_max, dm4_gu - d_gu_max,
                     dm5_gu - d_gu_max, dm6_gu - d_gu_max, 0, 0, 0, 0, 0, 0, 0, dl1_gu - d_gu_max, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     d_gu_min - dm1_gu, d_gu_min - dm2_gu, d_gu_min - dm3_gu, d_gu_min - dm4_gu,
                     d_gu_min - dm5_gu, d_gu_min - dm6_gu, 0, 0, 0, 0, 0, 0, 0, d_gu_min - dl1_gu, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     dm1_re - d_re_max, dm2_re - d_re_max, dm3_re - d_re_max, dm4_re - d_re_max,
                     dm5_re - d_re_max, dm6_re - d_re_max, dm7_re - d_re_max, dm8_re - d_re_max,
                     0, 0, 0, 0, 0, dl1_re - d_re_max, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     d_re_min - dm1_re, d_re_min - dm2_re, d_re_min - dm3_re, d_re_min - dm4_re,
                     d_re_min - dm5_re, d_re_min - dm6_re, d_re_min - dm7_re, d_re_min - dm8_re,
                     0, 0, 0, 0, 0, d_re_min - dl1_re, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     dm1_c - d_c_max, dm2_c - d_c_max, dm3_c - d_c_max, dm4_c - d_c_max,
                     dm5_c - d_c_max, dm6_c - d_c_max, 0, 0, 0, 0, 0, 0, 0, dl1_c - d_c_max, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     d_c_min - dm1_c, d_c_min - dm2_c, d_c_min - dm3_c, d_c_min - dm4_c,
                     d_c_min - dm5_c, d_c_min - dm6_c, 0, 0, 0, 0, 0, 0, 0, d_c_min - dl1_c, 0],
                    # [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                    #  sm1_shui - s_shui_max, sm2_shui - s_shui_max, 0, 0, 0, 0, sl1_shui - s_shui_max],
                    # [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                    #  s_shui_min - sm1_shui, s_shui_min - sm2_shui, 0, 0, 0, 0, s_shui_min - sl1_shui],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     sm1_hui - s_hui_max, sm2_hui - s_hui_max, 0, 0, 0, 0, sl1_hui - s_hui_max],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     s_hui_min - sm1_hui, s_hui_min - sm2_hui, 0, 0, 0, 0, s_hui_min - sl1_hui],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     sm1_huifa - s_huifa_max, sm2_huifa - s_huifa_max, 0, 0, 0, 0, sl1_huifa - s_huifa_max],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     s_huifa_min - sm1_huifa, s_huifa_min - sm2_huifa, 0, 0, 0, 0, s_huifa_min - sl1_huifa],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     sm1_liu - s_liu_max, sm2_liu - s_liu_max, 0, 0, 0, 0, sl1_liu - s_liu_max],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     s_liu_min - sm1_liu, s_liu_min - sm2_liu, 0, 0, 0, 0, s_liu_min - sl1_liu],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     sm1_gu - s_gu_max, sm2_gu - s_gu_max, 0, 0, 0, 0, sl1_gu - s_gu_max],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     s_gu_min - sm1_gu, s_gu_min - sm2_gu, 0, 0, 0, 0, s_gu_min - sl1_gu],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     sm1_mo - s_mo_max, sm2_mo - s_mo_max, 0, 0, 0, 0, sl1_mo - s_mo_max],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     s_mo_min - sm1_mo, s_mo_min - sm2_mo, 0, 0, 0, 0, s_mo_min - sl1_mo],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     sm1_re - s_re_max, sm2_re - s_re_max, 0, 0, 0, 0, sl1_re - s_re_max],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     s_re_min - sm1_re, s_re_min - sm2_re, 0, 0, 0, 0, s_re_min - sl1_re],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     sm1_c - s_c_max, sm2_c - s_c_max, 0, 0, 0, 0, sl1_c - s_c_max],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     s_c_min - sm1_c, s_c_min - sm2_c, 0, 0, 0, 0, s_c_min - sl1_c],
                    [100-p1_1_ratio_max, -p1_1_ratio_max, -p1_1_ratio_max, -p1_1_ratio_max,
                     -p1_1_ratio_max, -p1_1_ratio_max, -p1_1_ratio_max, -p1_1_ratio_max, 0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, -p1_1_ratio_max, -p1_1_ratio_max, -p1_1_ratio_max, 0, 0],
                    [p1_1_ratio_min - 100, p1_1_ratio_min, p1_1_ratio_min, p1_1_ratio_min,
                     p1_1_ratio_min,p1_1_ratio_min, p1_1_ratio_min, p1_1_ratio_min, 0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, p1_1_ratio_min, p1_1_ratio_min, p1_1_ratio_min, 0, 0],
                    [100 - p_1_ratio_max, -p_1_ratio_max, -p_1_ratio_max, -p_1_ratio_max,
                     -p_1_ratio_max, -p_1_ratio_max, -p_1_ratio_max, -p_1_ratio_max, 0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, -p_1_ratio_max, -p_1_ratio_max, -p_1_ratio_max, 0, 0],
                    [p_1_ratio_min - 100, p_1_ratio_min, p_1_ratio_min, p_1_ratio_min,
                     p_1_ratio_min, p_1_ratio_min, p_1_ratio_min, p_1_ratio_min, 0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, p_1_ratio_min, p_1_ratio_min, p_1_ratio_min, 0, 0],
                    [-p2_2_ratio_max, 100 - p2_2_ratio_max, -p2_2_ratio_max, -p2_2_ratio_max,
                     -p2_2_ratio_max, -p2_2_ratio_max, -p2_2_ratio_max, -p2_2_ratio_max, 0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, -p2_2_ratio_max, -p2_2_ratio_max, -p2_2_ratio_max, 0, 0],
                    [p2_2_ratio_min, p2_2_ratio_min - 100, p2_2_ratio_min, p2_2_ratio_min,
                     p2_2_ratio_min, p2_2_ratio_min, p2_2_ratio_min, p2_2_ratio_min, 0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, p2_2_ratio_min, p2_2_ratio_min, p2_2_ratio_min, 0, 0],
                    [-p3_2_ratio_max, -p3_2_ratio_max, 100 - p3_2_ratio_max, -p3_2_ratio_max,
                     -p3_2_ratio_max, -p3_2_ratio_max, -p3_2_ratio_max, -p3_2_ratio_max, 0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, -p3_2_ratio_max, -p3_2_ratio_max, -p3_2_ratio_max, 0, 0],
                    [p3_2_ratio_min, p3_2_ratio_min, p3_2_ratio_min - 100, p3_2_ratio_min,
                     p3_2_ratio_min, p3_2_ratio_min, p3_2_ratio_min, p3_2_ratio_min, 0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, p3_2_ratio_min, p3_2_ratio_min, p3_2_ratio_min, 0, 0],
                    [-p4_2_ratio_max, -p4_2_ratio_max, -p4_2_ratio_max, 100 - p4_2_ratio_max,
                     -p4_2_ratio_max, -p4_2_ratio_max, -p4_2_ratio_max, -p4_2_ratio_max, 0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, -p4_2_ratio_max, -p4_2_ratio_max, -p4_2_ratio_max, 0, 0],
                    [p4_2_ratio_min, p4_2_ratio_min, p4_2_ratio_min, p4_2_ratio_min - 100,
                     p4_2_ratio_min, p4_2_ratio_min, p4_2_ratio_min, p4_2_ratio_min, 0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, p4_2_ratio_min, p4_2_ratio_min, p4_2_ratio_min, 0, 0],
                    [-p5_2_ratio_max, -p5_2_ratio_max, -p5_2_ratio_max, -p5_2_ratio_max,
                     100 - p5_2_ratio_max, -p5_2_ratio_max, -p5_2_ratio_max, -p5_2_ratio_max, 0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, -p5_2_ratio_max, -p5_2_ratio_max, -p5_2_ratio_max, 0, 0],
                    [p5_2_ratio_min, p5_2_ratio_min, p5_2_ratio_min, p5_2_ratio_min,
                     p5_2_ratio_min - 100, p5_2_ratio_min, p5_2_ratio_min, p5_2_ratio_min, 0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, p5_2_ratio_min, p5_2_ratio_min, p5_2_ratio_min, 0, 0],
                    [-p6_2_ratio_max, -p6_2_ratio_max, -p6_2_ratio_max, -p6_2_ratio_max,
                     -p6_2_ratio_max, 100 - p6_2_ratio_max, -p6_2_ratio_max, -p6_2_ratio_max, 0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, -p6_2_ratio_max, -p6_2_ratio_max, -p6_2_ratio_max, 0, 0],
                    [p6_2_ratio_min, p6_2_ratio_min, p6_2_ratio_min, p6_2_ratio_min,
                     p6_2_ratio_min, p6_2_ratio_min - 100, p6_2_ratio_min, p6_2_ratio_min, 0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, p6_2_ratio_min, p6_2_ratio_min, p6_2_ratio_min, 0, 0],
                    [-p7_2_ratio_max, -p7_2_ratio_max, -p7_2_ratio_max, -p7_2_ratio_max,
                     -p7_2_ratio_max, -p7_2_ratio_max, 100 - p7_2_ratio_max, -p7_2_ratio_max, 0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, -p7_2_ratio_max, -p7_2_ratio_max, -p7_2_ratio_max, 0, 0],
                    [p7_2_ratio_min, p7_2_ratio_min, p7_2_ratio_min, p7_2_ratio_min,
                     p7_2_ratio_min, p7_2_ratio_min, p7_2_ratio_min - 100, p7_2_ratio_min, 0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, p7_2_ratio_min, p7_2_ratio_min, p7_2_ratio_min, 0, 0],
                    [-p8_2_ratio_max, -p8_2_ratio_max, -p8_2_ratio_max, -p8_2_ratio_max,
                     -p8_2_ratio_max, -p8_2_ratio_max, -p8_2_ratio_max, 100 - p8_2_ratio_max, 0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, -p8_2_ratio_max, -p8_2_ratio_max, -p8_2_ratio_max, 0, 0],
                    [p8_2_ratio_min, p8_2_ratio_min, p8_2_ratio_min, p8_2_ratio_min,
                     p8_2_ratio_min, p8_2_ratio_min, p8_2_ratio_min, p8_2_ratio_min - 100, 0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, p8_2_ratio_min, p8_2_ratio_min, p8_2_ratio_min, 0, 0],
                    [-p_2_ratio_max, 100 - p_2_ratio_max, 100 - p_2_ratio_max, 100 - p_2_ratio_max,
                     100 - p_2_ratio_max, 100 - p_2_ratio_max, 100 - p_2_ratio_max,100 - p_2_ratio_max,
                     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -p_2_ratio_max, -p_2_ratio_max, -p_2_ratio_max, 0, 0],
                    [p_2_ratio_min, p_2_ratio_min - 100, p_2_ratio_min - 100, p_2_ratio_min - 100,
                     p_2_ratio_min - 100, p_2_ratio_min - 100, p_2_ratio_min - 100, p_2_ratio_min - 100,
                     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, p_2_ratio_min, p_2_ratio_min, p_2_ratio_min, 0, 0],
                    [-p9_3_ratio_max, -p9_3_ratio_max, -p9_3_ratio_max, -p9_3_ratio_max,
                     -p9_3_ratio_max, -p9_3_ratio_max, -p9_3_ratio_max, -p9_3_ratio_max, 0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, 100 - p9_3_ratio_max, -p9_3_ratio_max, -p9_3_ratio_max, 0, 0],
                    [p9_3_ratio_min , p9_3_ratio_min, p9_3_ratio_min, p9_3_ratio_min,
                     p9_3_ratio_min, p9_3_ratio_min, p9_3_ratio_min, p9_3_ratio_min, 0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, p9_3_ratio_min - 100, p9_3_ratio_min, p9_3_ratio_min, 0, 0],
                    [-p10_3_ratio_max, -p10_3_ratio_max, -p10_3_ratio_max, -p10_3_ratio_max,
                     -p10_3_ratio_max, -p10_3_ratio_max, -p10_3_ratio_max, -p10_3_ratio_max, 0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, -p10_3_ratio_max, 100 - p10_3_ratio_max, -p10_3_ratio_max, 0, 0],
                    [p10_3_ratio_min, p10_3_ratio_min, p10_3_ratio_min, p10_3_ratio_min,
                     p10_3_ratio_min, p10_3_ratio_min, p10_3_ratio_min, p10_3_ratio_min, 0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, p10_3_ratio_min, p10_3_ratio_min - 100, p10_3_ratio_min, 0, 0],
                    [-p11_3_ratio_max, -p11_3_ratio_max, -p11_3_ratio_max, -p11_3_ratio_max,
                     -p11_3_ratio_max, -p11_3_ratio_max, -p11_3_ratio_max, -p11_3_ratio_max, 0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, -p11_3_ratio_max, -p11_3_ratio_max, 100 - p11_3_ratio_max, 0, 0],
                    [p11_3_ratio_min , p11_3_ratio_min, p11_3_ratio_min, p11_3_ratio_min,
                     p11_3_ratio_min, p11_3_ratio_min, p11_3_ratio_min, p11_3_ratio_min, 0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, p11_3_ratio_min, p11_3_ratio_min, p11_3_ratio_min - 100, 0, 0],
                    [-p_3_ratio_max, -p_3_ratio_max, -p_3_ratio_max, -p_3_ratio_max,
                     -p_3_ratio_max, -p_3_ratio_max, -p_3_ratio_max, -p_3_ratio_max, 0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, 100 - p_3_ratio_max, 100 - p_3_ratio_max, 100 - p_3_ratio_max, 0, 0],
                    [p_3_ratio_min, p_3_ratio_min, p_3_ratio_min, p_3_ratio_min,
                     p_3_ratio_min, p_3_ratio_min, p_3_ratio_min, p_3_ratio_min, 0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, p_3_ratio_min - 100, p_3_ratio_min - 100, p_3_ratio_min - 100, 0, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     100 - d1_1_ratio_max, -d1_1_ratio_max, -d1_1_ratio_max, -d1_1_ratio_max,
                     -d1_1_ratio_max, -d1_1_ratio_max, -d1_1_ratio_max, -d1_1_ratio_max,
                     0, 0, 0, 0, 0, -d1_1_ratio_max, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     d1_1_ratio_min - 100, d1_1_ratio_min, d1_1_ratio_min, d1_1_ratio_min,
                     d1_1_ratio_min, d1_1_ratio_min, d1_1_ratio_min, d1_1_ratio_min,
                     0, 0, 0, 0, 0, d1_1_ratio_min, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     -d2_1_ratio_max, 100-d2_1_ratio_max, -d2_1_ratio_max, -d2_1_ratio_max,
                     -d2_1_ratio_max, -d2_1_ratio_max, -d2_1_ratio_max, -d2_1_ratio_max,
                     0, 0, 0, 0, 0, -d2_1_ratio_max,  0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     d2_1_ratio_min, d2_1_ratio_min - 100, d2_1_ratio_min, d2_1_ratio_min,
                     d2_1_ratio_min, d2_1_ratio_min, d2_1_ratio_min, d2_1_ratio_min,
                     0, 0, 0, 0, 0, d2_1_ratio_min,  0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     -d3_1_ratio_max, -d3_1_ratio_max, 100 - d3_1_ratio_max, -d3_1_ratio_max,
                     -d3_1_ratio_max, -d3_1_ratio_max, -d3_1_ratio_max, -d3_1_ratio_max,
                     0, 0, 0, 0, 0, -d3_1_ratio_max,  0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     d3_1_ratio_min, d3_1_ratio_min, d3_1_ratio_min - 100, d3_1_ratio_min,
                     d3_1_ratio_min, d3_1_ratio_min, d3_1_ratio_min, d3_1_ratio_min,
                     0, 0, 0, 0, 0, d3_1_ratio_min, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     -d4_1_ratio_max, -d4_1_ratio_max, -d4_1_ratio_max, 100 - d4_1_ratio_max,
                     -d4_1_ratio_max, -d4_1_ratio_max, -d4_1_ratio_max, -d4_1_ratio_max,
                     0, 0, 0, 0, 0, -d4_1_ratio_max, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     d4_1_ratio_min, d4_1_ratio_min, d4_1_ratio_min, d4_1_ratio_min - 100,
                     d4_1_ratio_min, d4_1_ratio_min, d4_1_ratio_min, d4_1_ratio_min,
                     0, 0, 0, 0, 0, d4_1_ratio_min,  0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     100 - d_1_ratio_max, 100 - d_1_ratio_max, 100 -d_1_ratio_max, 100 - d_1_ratio_max,
                     -d_1_ratio_max, -d_1_ratio_max, -d_1_ratio_max, -d_1_ratio_max,
                     0, 0, 0, 0, 0, -d_1_ratio_max,  0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     d_1_ratio_min - 100, d_1_ratio_min - 100, d_1_ratio_min - 100, d_1_ratio_min - 100,
                     d_1_ratio_min, d_1_ratio_min, d_1_ratio_min, d_1_ratio_min,
                     0, 0, 0, 0, 0, d_1_ratio_min,  0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     -d5_2_ratio_max, -d5_2_ratio_max, -d5_2_ratio_max, -d5_2_ratio_max,
                     100-d5_2_ratio_max, -d5_2_ratio_max, -d5_2_ratio_max, -d5_2_ratio_max,
                     0, 0, 0, 0, 0, -d5_2_ratio_max,  0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     d5_2_ratio_min, d5_2_ratio_min, d5_2_ratio_min, d5_2_ratio_min,
                     d5_2_ratio_min - 100, d5_2_ratio_min, d5_2_ratio_min, d5_2_ratio_min,
                     0, 0, 0, 0, 0, d5_2_ratio_min,  0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     -d6_2_ratio_max, -d6_2_ratio_max, -d6_2_ratio_max, -d6_2_ratio_max,
                     -d6_2_ratio_max, 100 - d6_2_ratio_max, -d6_2_ratio_max, -d6_2_ratio_max,
                     0, 0, 0, 0, 0, -d6_2_ratio_max, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     d6_2_ratio_min, d6_2_ratio_min, d6_2_ratio_min, d6_2_ratio_min,
                     d6_2_ratio_min, d6_2_ratio_min - 100, d6_2_ratio_min, d6_2_ratio_min,
                     0, 0, 0, 0, 0, d6_2_ratio_min, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     -d7_2_ratio_max, -d7_2_ratio_max, -d7_2_ratio_max, -d7_2_ratio_max,
                     -d7_2_ratio_max, -d7_2_ratio_max, 100 - d7_2_ratio_max, -d7_2_ratio_max,
                     0, 0, 0, 0, 0, -d7_2_ratio_max,  0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     d7_2_ratio_min, d7_2_ratio_min, d7_2_ratio_min, d7_2_ratio_min,
                     d7_2_ratio_min, d7_2_ratio_min, d7_2_ratio_min - 100, d7_2_ratio_min,
                     0, 0, 0, 0, 0, d7_2_ratio_min, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     -d8_2_ratio_max, -d8_2_ratio_max, -d8_2_ratio_max, -d8_2_ratio_max,
                     -d8_2_ratio_max, -d8_2_ratio_max, -d8_2_ratio_max, 100 - d8_2_ratio_max,
                     0, 0, 0, 0, 0, -d8_2_ratio_max, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     d8_2_ratio_min, d8_2_ratio_min, d8_2_ratio_min, d8_2_ratio_min,
                     d8_2_ratio_min, d8_2_ratio_min, d8_2_ratio_min, d8_2_ratio_min - 100,
                     0, 0, 0, 0, 0, d8_2_ratio_min, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     -d_2_ratio_max, -d_2_ratio_max, -d_2_ratio_max, -d_2_ratio_max,
                     100 - d_2_ratio_max, 100 - d_2_ratio_max, 100 - d_2_ratio_max, 100 - d_2_ratio_max,
                     0, 0, 0, 0, 0, -d_2_ratio_max, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     d_2_ratio_min, d_2_ratio_min, d_2_ratio_min, d_2_ratio_min,
                     d_2_ratio_min - 100, d_2_ratio_min - 100, d_2_ratio_min - 100, d_2_ratio_min - 100,
                     0, 0, 0, 0, 0, d_2_ratio_min, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     -d9_3_ratio_max, -d9_3_ratio_max, -d9_3_ratio_max, -d9_3_ratio_max,
                     -d9_3_ratio_max, -d9_3_ratio_max, -d9_3_ratio_max, -d9_3_ratio_max,
                     0, 0, 0, 0, 0, 100 - d9_3_ratio_max, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     d9_3_ratio_min, d9_3_ratio_min, d9_3_ratio_min, d9_3_ratio_min,
                     d9_3_ratio_min, d9_3_ratio_min, d9_3_ratio_min, d9_3_ratio_min,
                     0, 0, 0, 0, 0, d9_3_ratio_min - 100, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     -d_3_ratio_max, -d_3_ratio_max, -d_3_ratio_max, -d_3_ratio_max,
                     -d_3_ratio_max, -d_3_ratio_max, -d_3_ratio_max, -d_3_ratio_max,
                     0, 0, 0, 0, 0, 100 - d_3_ratio_max,  0],
                    [0, 0, 0, 0, 0, 0, 0, 0,
                     d_3_ratio_min, d_3_ratio_min, d_3_ratio_min, d_3_ratio_min,
                     d_3_ratio_min, d_3_ratio_min, d_3_ratio_min, d_3_ratio_min,
                     0, 0, 0, 0, 0, d_3_ratio_min - 100, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     100 - s1_1_ratio_max, -s1_1_ratio_max,
                     0, 0, 0, 0, -s1_1_ratio_max],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     s1_1_ratio_min - 100, s1_1_ratio_min,
                     0, 0, 0, 0, s1_1_ratio_min],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     -s2_1_ratio_max, 100 - s2_1_ratio_max,
                     0, 0, 0, 0, -s2_1_ratio_max],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     s2_1_ratio_min, s2_1_ratio_min - 100,
                     0, 0, 0, 0, s2_1_ratio_min],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     100 - s_1_ratio_max, 100 - s_1_ratio_max,
                     0, 0, 0, 0, -s_1_ratio_max],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     s_1_ratio_min - 100, s_1_ratio_min - 100,
                     0, 0, 0, 0, s_1_ratio_min],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     -s3_2_ratio_max, -s3_2_ratio_max,
                     0, 0, 0, 0, 100 - s3_2_ratio_max],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     s3_2_ratio_min, s3_2_ratio_min,
                     0, 0, 0, 0, s3_2_ratio_min - 100],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     -s_2_ratio_max, -s_2_ratio_max,
                     0, 0, 0, 0,100 - s_2_ratio_max],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     s_2_ratio_min, s_2_ratio_min,
                     0, 0, 0, 0, s_2_ratio_min - 100]
                    ])  # 定义小于等于不等式约束矩阵
        e2 = array([[a11, a11, a11, a11, a11, a11, a11, a11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a12, a12, a12, 0, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0, a21, a21, a21, a21, a21, a21, a21, a21, 0, 0, 0, 0, 0, a22, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a31, a31, 0, 0, 0, 0, a32]])  # 定义等式约束矩阵
        f1 = array(
            [b0, b011, b012, b013, b014, b015, b01678, b021, b022, b023, b024, b025, b026, b031, b032,
             b041, b042, b043, b06, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
             0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
             0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
             0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
        f2 = array([b1, b2, b3])
        x = cp.Variable(23)
        obj = cp.Minimize(c @ x)
        cons = [e1 @ x <= f1, e2 @ x == f2, x >= 0]
        prob = cp.Problem(obj, cons)
        prob.solve(solver='GLPK_MI', verbose=True)
        print("最优初始值为:", prob.value)
        print("最优初始解为：\n", x.value)

        chushi_x11 = abs(x.value[0])
        chushi_x12 = abs(x.value[1])
        chushi_x13 = abs(x.value[2])
        chushi_x14 = abs(x.value[3])
        chushi_x15 = abs(x.value[4])
        chushi_x16 = abs(x.value[5])
        chushi_x17 = abs(x.value[6])
        chushi_x18 = abs(x.value[7])
        chushi_x21 = abs(x.value[8])
        chushi_x22 = abs(x.value[9])
        chushi_x23 = abs(x.value[10])
        chushi_x24 = abs(x.value[11])
        chushi_x25 = abs(x.value[12])
        chushi_x26 = abs(x.value[13])
        chushi_x27 = abs(x.value[14])
        chushi_x28 = abs(x.value[15])
        chushi_x31 = abs(x.value[16])
        chushi_x32 = abs(x.value[17])
        chushi_gaolu_gaizhi = abs(x.value[18])
        chushi_gaolu_tizhi = abs(x.value[19])
        chushi_gaolu_dingzhi = abs(x.value[20])
        chushi_fadian = abs(x.value[21])
        chushi_shaojie = abs(x.value[22])
        chushi_z = chushi_gaolu_gaizhi*c41 + chushi_gaolu_tizhi*c42 + chushi_gaolu_dingzhi*c43 + WT_waigoujiaotan * price_waigoujiaotan + WT_lianjiaomei * price_lianjiaomei + chushi_fadian * price_dianchanglantan + chushi_shaojie * price_shaojiejiaofen + chushi_x11 * shenfu_penchui_price + chushi_x12 * eluosi_penchui_price + chushi_x13 * yongxia_penchui_price + chushi_x14 * yongcheng_penchui_price + chushi_x15 * changcun_penchui_price + chushi_x16 * gaoping_penchui_price + chushi_x17 * zhaozhuang_penchui_price + chushi_x18 * yangquan2_penchui_price + chushi_x21 * datongpeiQ5800_fadian_price + chushi_x22 * datongpeiQ5500_fadian_price + chushi_x23 * datongpeiQ5200_fadian_price + chushi_x24 * datongpeiQ5000_fadian_price + chushi_x25 * shenfuyuan_fadian_price + chushi_x26 * shenfupei_fadian_price + chushi_x27 * shenyou2_fadian_price + chushi_x28 * shenwai3_fadian_price + chushi_x31 * jiaozuo_shaojie_price + chushi_x32 * jincheng_shaojie_price

        # x1:WT_penchuimei,x2:WT_fadianmei,x3:WT_shaojiemei, x1':WT_gaolulantan,x2':WT_dianchanglantan,x3':WT_shaojiejiaofen
        # min Z2 = WT_waigoujiaotan * price_waigoujiaotan + WT_shaojiejiaofen * price_shaojiejiaofen + WT_dianchanglantan * price_dianchanglantan + WT_gaolulantan * price_gaolulantan + WT_penchuimei * price_penchuimei + WT_lianjiaomei * price_lianjiaomei + WT_fadianmei * price_fadianmei + WT_shaojiemei * price_shaojiemei
        # 简化 min Z = c1 * x1 + c2 * x2 + c3 * x3 +c4 * x1' + c5 * x2' +c6 * x3'
        # Z2 = Z + C
        # st
        # x1 + x2 + x3 <= B3 - C12
        # a11 * x1 + a12 * x1' == b1 #喷吹煤&高炉兰炭
        # a21 * x2 + a22 * x2' == b2 #发电煤电&厂兰炭
        # a31 * x3 + a32 * x3' == b3 #烧结煤&烧结焦粉
        # x1,x2,x3,x1',x2',x3' >= 0
        data = {
            'name': ['shenfu', 'eluosi', 'yongxia', 'yongcheng', 'changcun', 'gaoping', 'zhaozhuang', 'yangquan2'],
            'price': [shenfu_penchui_price, eluosi_penchui_price, yongxia_penchui_price, yongcheng_penchui_price, changcun_penchui_price, gaoping_penchui_price, zhaozhuang_penchui_price, yangquan2_penchui_price],
            'rezhi': [pm1_re, pm2_re, pm3_re, pm4_re, pm5_re, pm6_re, pm7_re, pm8_re],
            'kegongziyuan': [shenfu_penchui_kegongziyuan, eluosi_penchui_kegongziyuan, yongxia_penchui_kegongziyuan, yongcheng_penchui_kegongziyuan, changcun_penchui_kegongziyuan, gaoping_zhaozhuang_yangquan2_penchui_kegongziyuan, gaoping_zhaozhuang_yangquan2_penchui_kegongziyuan, gaoping_zhaozhuang_yangquan2_penchui_kegongziyuan],
            'chushi': [chushi_x11,chushi_x12,chushi_x13,chushi_x14,chushi_x15,chushi_x16,chushi_x17,chushi_x18]
        }
        df_penchui = pd.DataFrame(data=data)
        # df_penchui = df_penchui.sort_values('price',ascending=True)
        df_penchui = df_penchui.sort_values('rezhi',ascending=True)

        def __cal_type(x):

            if x.chushi > 1:
                rst = 0
            else:
                rst = 1
            return rst

        df_penchui['TYPE'] = df_penchui.apply(lambda x: __cal_type(x), axis=1)
        df_penchui['ADD_TYPE'] = 0
        add_type = 0
        for index_df_penchui, row_df_penchui in df_penchui.iterrows():
            tmp_TYPE = df_penchui.loc[index_df_penchui, 'TYPE']
            if add_type == 0:
                if tmp_TYPE == 1:
                    df_penchui.loc[index_df_penchui, 'ADD_TYPE'] = 0
                    add_type = 0
                else:
                    df_penchui.loc[index_df_penchui, 'ADD_TYPE'] = 1
                    add_type = 1
            else:
                if tmp_TYPE == 1:
                    df_penchui.loc[index_df_penchui, 'ADD_TYPE'] = 0
                    add_type = 1
                else:
                    df_penchui.loc[index_df_penchui, 'ADD_TYPE'] = 0
                    add_type = 1

        df_penchui.index = df_penchui['name']
        data = {
            'name': ['datongpeiQ5800', 'datongpeiQ5500', 'datongpeiQ5200', 'datongpeiQ5000', 'shenfuyuan', 'shenfupei',
                     'shenyou2', 'shenwai3'],
            'price': [datongpeiQ5800_fadian_price, datongpeiQ5500_fadian_price, datongpeiQ5200_fadian_price,
                      datongpeiQ5000_fadian_price,
                      shenfuyuan_fadian_price, shenfupei_fadian_price, shenyou2_fadian_price, shenwai3_fadian_price],
            'rezhi': [dm1_re, dm2_re, dm3_re,
                      dm4_re,
                      dm5_re, dm6_re, dm7_re, dm8_re],
            'kegongziyuan': [datongpeiQ5800_fadian_kegongziyuan, datongpeiQ5500_fadian_kegongziyuan,
                             datongpeiQ5200_fadian_kegongziyuan,
                             datongpeiQ5000_fadian_kegongziyuan, shenfuyuan_fadian_kegongziyuan,
                             shenfupei_fadian_kegongziyuan,
                             10000, 10000],
            'chushi': [chushi_x21, chushi_x22, chushi_x23, chushi_x24, chushi_x25, chushi_x26, chushi_x27, chushi_x28]
        }
        df_fadian = pd.DataFrame(data=data)
        # df_fadian = df_fadian.sort_values('price',ascending=True)
        df_fadian = df_fadian.sort_values('rezhi',ascending=True)
        df_fadian['TYPE'] = df_fadian.apply(lambda x: __cal_type(x), axis=1)
        df_fadian['ADD_TYPE'] = 0
        add_type = 0
        for index_df_fadian, row_df_fadian in df_fadian.iterrows():
            tmp_TYPE = df_fadian.loc[index_df_fadian, 'TYPE']
            if add_type == 0:
                if tmp_TYPE == 1:
                    df_fadian.loc[index_df_fadian, 'ADD_TYPE'] = 0
                    add_type = 0
                else:
                    df_fadian.loc[index_df_fadian, 'ADD_TYPE'] = 1
                    add_type = 1
            else:
                if tmp_TYPE == 1:
                    df_fadian.loc[index_df_fadian, 'ADD_TYPE'] = 0
                    add_type = 1
                else:
                    df_fadian.loc[index_df_fadian, 'ADD_TYPE'] = 0
                    add_type = 1

        df_fadian.index = df_fadian['name']
        # print(df_fadian.loc['shenfuyuan', 'chushi'])
        data = {
            'name': ['jiaozuo', 'jincheng'],
            'price': [jiaozuo_shaojie_price, jincheng_shaojie_price],
            'rezhi': [sm1_re, sm2_re],
            'kegongziyuan': [jiaozuo_shaojie_kegongziyuan, jincheng_shaojie_kegongziyuan],
            'chushi': [chushi_x31, chushi_x32]
        }
        df_shaojie = pd.DataFrame(data=data)
        # df_shaojie = df_shaojie.sort_values('price', ascending=True)
        df_shaojie = df_shaojie.sort_values('rezhi', ascending=True)

        df_shaojie['TYPE'] = df_shaojie.apply(lambda x: __cal_type(x), axis=1)

        df_shaojie['ADD_TYPE'] = 0
        add_type = 0
        for index_df_shaojie, row_df_shaojie in df_shaojie.iterrows():
            tmp_TYPE = df_shaojie.loc[index_df_shaojie, 'TYPE']
            if add_type == 0:
                if tmp_TYPE == 1:
                    df_shaojie.loc[index_df_shaojie, 'ADD_TYPE'] = 0
                    add_type = 0
                else:
                    df_shaojie.loc[index_df_shaojie, 'ADD_TYPE'] = 1
                    add_type = 1
            else:
                if tmp_TYPE == 1:
                    df_shaojie.loc[index_df_shaojie, 'ADD_TYPE'] = 0
                    add_type = 1
                else:
                    df_shaojie.loc[index_df_shaojie, 'ADD_TYPE'] = 0
                    add_type = 1

        df_shaojie.index = df_shaojie['name']

        data = {
            'name': ['tizhijiaofen', 'dingzhilantan'],
            'price': [c42, c43],
            'rezhi': [pl2_re, pl3_re],
            'kegongziyuan': [tizhijiaofen_penchui_kegongziyuan, dingzhilantan_penchui_kegongziyuan],
            'chushi': [chushi_gaolu_tizhi, chushi_gaolu_dingzhi]
        }
        df_gaolu = pd.DataFrame(data=data)
        df_gaolu = df_gaolu.sort_values('rezhi', ascending=True)

        df_gaolu['TYPE'] = df_gaolu.apply(lambda x: __cal_type(x), axis=1)

        df_gaolu['ADD_TYPE'] = 0
        add_type = 0
        for index_df_gaolu, row_df_gaolu in df_gaolu.iterrows():
            tmp_TYPE = df_gaolu.loc[index_df_gaolu, 'TYPE']
            if add_type == 0:
                if tmp_TYPE == 1:
                    df_gaolu.loc[index_df_gaolu, 'ADD_TYPE'] = 0
                    add_type = 0
                else:
                    df_gaolu.loc[index_df_gaolu, 'ADD_TYPE'] = 1
                    add_type = 1
            else:
                if tmp_TYPE == 1:
                    df_gaolu.loc[index_df_gaolu, 'ADD_TYPE'] = 0
                    add_type = 1
                else:
                    df_gaolu.loc[index_df_gaolu, 'ADD_TYPE'] = 0
                    add_type = 1

        df_gaolu.index = df_gaolu['name']


        max_constant = kongmeizhibiao - WT_lianjiaomei
        low = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
        up = [shenfu_penchui_kegongziyuan, eluosi_penchui_kegongziyuan, yongxia_penchui_kegongziyuan,
              yongcheng_penchui_kegongziyuan, changcun_penchui_kegongziyuan,
              gaoping_zhaozhuang_yangquan2_penchui_kegongziyuan, gaoping_zhaozhuang_yangquan2_penchui_kegongziyuan,
              gaoping_zhaozhuang_yangquan2_penchui_kegongziyuan, datongpeiQ5800_fadian_kegongziyuan,
              datongpeiQ5500_fadian_kegongziyuan, datongpeiQ5200_fadian_kegongziyuan, datongpeiQ5000_fadian_kegongziyuan,
              shenfuyuan_fadian_kegongziyuan, shenfupei_fadian_kegongziyuan, max_constant, max_constant,
              jiaozuo_shaojie_kegongziyuan, jincheng_shaojie_kegongziyuan, 30, 20]
        bound = []  # 变量的约束范围
        bound.append(low)
        bound.append(up)


        def calc_f(X):
            shenfu_penchui_wt = X[0]
            eluosi_penchui_wt = X[1]
            yongxia_penchui_wt = X[2]
            yongcheng_penchui_wt = X[3]
            changcun_penchui_wt = X[4]
            gaoping_penchui_wt = X[5]
            zhaozhuang_penchui_wt = X[6]
            yangquan2_penchui_wt = X[7]
            datongpeiQ5800_fadian_wt = X[8]
            datongpeiQ5500_fadian_wt = X[9]
            datongpeiQ5200_fadian_wt = X[10]
            datongpeiQ5000_fadian_wt = X[11]
            shenfuyuan_fadian_wt = X[12]
            shenfupei_fadian_wt = X[13]
            shenyou2_fadian_wt = X[14]
            shenwai3_fadian_wt = X[15]
            jiaozuo_shaojie_wt = X[16]
            jincheng_shaojie_wt = X[17]
            tizhi_penchui_wt = X[18]
            dingzhi_penchui_wt = X[19]


            WT_gaolulantan = (tieshuichanliang * chunmeibi / 1000 -  (100 - penchuimeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[0] + X[1] + X[2] + X[3] + X[4] + X[5] + X[6] + X[7])) / ( (100 - lantanshuifen) / 100)
            gaizhi_penchui_wt = WT_gaolulantan - tizhi_penchui_wt - dingzhi_penchui_wt
            WT_dianchanglantan = (fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100 - 100 / (100 + meitanwushunlv) * (X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15]) ) / (100 / (100 + meitanwushunlv))
            WT_shaojiejiaofen = ((shaojiechanliang * shaojieranliaobi / 1000 - jiaotanchanliang * cujiaolv / 100 - WT_waigoujiaotan * waigoujiaofenlv / 100 * (100 - waigoujiaoshuifen) / 100) - (100 - shaojiemeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[16] + X[17]) ) / ((100 - shaojiejiaofenshuifen) / 100 )


            WT_dianchanglantan = WT_dianchanglantan
            WT_shaojiejiaofen = WT_shaojiejiaofen
            # WT_gaolulantan = WT_gaolulantan
            Z = gaizhi_penchui_wt * c41 + tizhi_penchui_wt * c42 + dingzhi_penchui_wt * c43 + WT_dianchanglantan * price_dianchanglantan + WT_shaojiejiaofen * price_shaojiejiaofen + shenfu_penchui_wt * shenfu_penchui_price + eluosi_penchui_wt * eluosi_penchui_price + yongxia_penchui_wt * yongxia_penchui_price + yongcheng_penchui_wt * yongcheng_penchui_price + changcun_penchui_wt * changcun_penchui_price + gaoping_penchui_wt * gaoping_penchui_price + zhaozhuang_penchui_wt * zhaozhuang_penchui_price + yangquan2_penchui_wt * yangquan2_penchui_price + datongpeiQ5800_fadian_wt * datongpeiQ5800_fadian_price + datongpeiQ5500_fadian_wt * datongpeiQ5500_fadian_price + datongpeiQ5200_fadian_wt * datongpeiQ5200_fadian_price + datongpeiQ5000_fadian_wt * datongpeiQ5000_fadian_price + shenfuyuan_fadian_wt * shenfuyuan_fadian_price + shenfupei_fadian_wt * shenfupei_fadian_price + shenyou2_fadian_wt * shenyou2_fadian_price + shenwai3_fadian_wt * shenwai3_fadian_price + jiaozuo_shaojie_wt * jiaozuo_shaojie_price + jincheng_shaojie_wt * jincheng_shaojie_price
            return Z




        X = np.random.uniform(0, 1, size=(size, dim))

        for i in range(size):
            ADD_penchui = X[i][0]*df_penchui.loc['shenfu','TYPE']+X[i][1]*df_penchui.loc['eluosi','TYPE']+X[i][2]*df_penchui.loc['yongxia','TYPE']+X[i][3]*df_penchui.loc['yongcheng','TYPE']+X[i][4]*df_penchui.loc['changcun','TYPE']+X[i][5]*df_penchui.loc['gaoping','TYPE']+X[i][6]*df_penchui.loc['zhaozhuang','TYPE']+X[i][7]*df_penchui.loc['yangquan2','TYPE']
            ADD_TYPE_penchui_HAS_1 = df_penchui.loc['shenfu','ADD_TYPE']+df_penchui.loc['eluosi','ADD_TYPE']+df_penchui.loc['yongxia','TYPE']+df_penchui.loc['yongcheng','TYPE']+df_penchui.loc['changcun','TYPE']+df_penchui.loc['gaoping','TYPE']+df_penchui.loc['zhaozhuang','TYPE']+df_penchui.loc['yangquan2','TYPE']
            if ADD_TYPE_penchui_HAS_1 > 0 :
                if df_penchui.loc['shenfu', 'TYPE'] == 1:
                    X[i][0] = df_penchui.loc['shenfu', 'chushi'] + X[i][0]
                else:
                    X[i][0] = df_penchui.loc['shenfu', 'chushi']
                if df_penchui.loc['eluosi', 'TYPE'] == 1:
                    X[i][1] = df_penchui.loc['eluosi', 'chushi'] + X[i][1]
                else:
                    X[i][1] = df_penchui.loc['eluosi', 'chushi']
                if df_penchui.loc['yongxia', 'TYPE'] == 1:
                    X[i][2] = df_penchui.loc['yongxia', 'chushi'] + X[i][2]
                else:
                    X[i][2] = df_penchui.loc['yongxia', 'chushi']
                if df_penchui.loc['yongcheng', 'TYPE'] == 1:
                    X[i][3] = df_penchui.loc['yongcheng', 'chushi'] + X[i][3]
                else:
                    X[i][3] = df_penchui.loc['yongcheng', 'chushi']
                if df_penchui.loc['changcun', 'TYPE'] == 1:
                    X[i][4] = df_penchui.loc['changcun', 'chushi'] + X[i][4]
                else:
                    X[i][4] = df_penchui.loc['changcun', 'chushi']
                if df_penchui.loc['gaoping', 'TYPE'] == 1:
                    X[i][5] = df_penchui.loc['gaoping', 'chushi'] + X[i][5]
                else:
                    X[i][5] = df_penchui.loc['gaoping', 'chushi']
                if df_penchui.loc['zhaozhuang', 'TYPE'] == 1:
                    X[i][6] = df_penchui.loc['zhaozhuang', 'chushi'] + X[i][6]
                else:
                    X[i][6] = df_penchui.loc['zhaozhuang', 'chushi']
                if df_penchui.loc['yangquan2', 'TYPE'] == 1:
                    X[i][7] = df_penchui.loc['yangquan2', 'chushi'] + X[i][7]
                else:
                    X[i][7] = df_penchui.loc['yangquan2', 'chushi']

                if df_penchui.loc['shenfu', 'ADD_TYPE'] == 1:
                    X[i][0] = df_penchui.loc['shenfu', 'chushi'] - ADD_penchui
                else:
                    X[i][0] = X[i][0]
                if df_penchui.loc['eluosi', 'ADD_TYPE'] == 1:
                    X[i][1] = df_penchui.loc['eluosi', 'chushi'] - ADD_penchui
                else:
                    X[i][1] = X[i][1]
                if df_penchui.loc['yongxia', 'ADD_TYPE'] == 1:
                    X[i][2] = df_penchui.loc['yongxia', 'chushi']- ADD_penchui
                else:
                    X[i][2] = X[i][2]
                if df_penchui.loc['yongcheng', 'ADD_TYPE'] == 1:
                    X[i][3] = df_penchui.loc['yongcheng', 'chushi']- ADD_penchui
                else:
                    X[i][3] = X[i][3]
                if df_penchui.loc['changcun', 'ADD_TYPE'] == 1:
                    X[i][4] = df_penchui.loc['changcun', 'chushi'] - ADD_penchui
                else:
                    X[i][4] = X[i][4]
                if df_penchui.loc['gaoping', 'ADD_TYPE'] == 1:
                    X[i][5] = df_penchui.loc['gaoping', 'chushi']- ADD_penchui
                else:
                    X[i][5] = X[i][5]
                if df_penchui.loc['zhaozhuang', 'ADD_TYPE'] == 1:
                    X[i][6] = df_penchui.loc['zhaozhuang', 'chushi'] - ADD_penchui
                else:
                    X[i][6] = X[i][6]
                if df_penchui.loc['yangquan2', 'ADD_TYPE'] == 1:
                    X[i][7] = df_penchui.loc['yangquan2', 'chushi'] - ADD_penchui
                else:
                    X[i][7] = X[i][7]
            else:
                X[i][0] = df_penchui.loc['shenfu', 'chushi']
                X[i][1] = df_penchui.loc['eluosi', 'chushi']
                X[i][2] = df_penchui.loc['yongxia', 'chushi']
                X[i][3] = df_penchui.loc['yongcheng', 'chushi']
                X[i][4] = df_penchui.loc['changcun', 'chushi']
                X[i][5] = df_penchui.loc['gaoping', 'chushi']
                X[i][6] = df_penchui.loc['zhaozhuang', 'chushi']
                X[i][7] = df_penchui.loc['yangquan2', 'chushi']


            ADD_fadian = X[i][8] * df_fadian.loc['datongpeiQ5800', 'TYPE'] + X[i][9] * df_fadian.loc['datongpeiQ5500', 'TYPE'] + \
                         X[i][10] * df_fadian.loc['datongpeiQ5200', 'TYPE'] + X[i][11] * df_fadian.loc['datongpeiQ5000', 'TYPE'] + X[i][12] * \
                          df_fadian.loc['shenfuyuan', 'TYPE'] + X[i][13] * df_fadian.loc['shenfupei', 'TYPE'] + X[i][14] * \
                          df_fadian.loc['shenyou2', 'TYPE'] + X[i][15] * df_fadian.loc['shenwai3', 'TYPE']
            ADD_TYPE_fadian_HAS_1=df_fadian.loc['datongpeiQ5800', 'ADD_TYPE']+df_fadian.loc['datongpeiQ5500', 'ADD_TYPE']+df_fadian.loc['datongpeiQ5200', 'ADD_TYPE']+df_fadian.loc['datongpeiQ5000', 'ADD_TYPE']+df_fadian.loc['shenfuyuan', 'ADD_TYPE']+df_fadian.loc['shenfupei', 'ADD_TYPE'] +df_fadian.loc['shenyou2', 'ADD_TYPE']+df_fadian.loc['shenwai3', 'ADD_TYPE']
            if ADD_TYPE_fadian_HAS_1>0:
                if df_fadian.loc['datongpeiQ5800', 'TYPE'] == 1:
                    X[i][8] = df_fadian.loc['datongpeiQ5800', 'chushi'] + X[i][8]
                else:
                    X[i][8] = df_fadian.loc['datongpeiQ5800', 'chushi']
                if df_fadian.loc['datongpeiQ5500', 'TYPE'] == 1:
                    X[i][9] = df_fadian.loc['datongpeiQ5500', 'chushi'] + X[i][9]
                else:
                    X[i][9] = df_fadian.loc['datongpeiQ5500', 'chushi']
                if df_fadian.loc['datongpeiQ5200', 'TYPE'] == 1:
                    X[i][10] = df_fadian.loc['datongpeiQ5200', 'chushi'] + X[i][10]
                else:
                    X[i][10] = df_fadian.loc['datongpeiQ5200', 'chushi']
                if df_fadian.loc['datongpeiQ5000', 'TYPE'] == 1:
                    X[i][11] = df_fadian.loc['datongpeiQ5000', 'chushi'] + X[i][11]
                else:
                    X[i][11] = df_fadian.loc['datongpeiQ5000', 'chushi']
                if df_fadian.loc['shenfuyuan', 'TYPE'] == 1:
                    X[i][12] = df_fadian.loc['shenfuyuan', 'chushi'] + X[i][12]
                else:
                    X[i][12] = df_fadian.loc['shenfuyuan', 'chushi']
                if df_fadian.loc['shenfupei', 'TYPE'] == 1:
                    X[i][13] = df_fadian.loc['shenfupei', 'chushi'] + X[i][13]
                else:
                    X[i][13] = df_fadian.loc['shenfupei', 'chushi']
                if df_fadian.loc['shenyou2', 'TYPE'] == 1:
                    X[i][14] = df_fadian.loc['shenyou2', 'chushi'] + X[i][14]
                else:
                    X[i][14] = df_fadian.loc['shenyou2', 'chushi']
                if df_fadian.loc['shenwai3', 'TYPE'] == 1:
                    X[i][15] = df_fadian.loc['shenwai3', 'chushi'] + X[i][15]
                else:
                    X[i][15] = df_fadian.loc['shenwai3', 'chushi']

                if df_fadian.loc['datongpeiQ5800', 'ADD_TYPE'] == 1:
                    X[i][8] = df_fadian.loc['datongpeiQ5800', 'chushi']-ADD_fadian
                else:
                    X[i][8] = X[i][8]
                if df_fadian.loc['datongpeiQ5500', 'ADD_TYPE'] == 1:
                    X[i][9] = df_fadian.loc['datongpeiQ5500', 'chushi']-ADD_fadian
                else:
                    X[i][9] = X[i][9]
                if df_fadian.loc['datongpeiQ5200', 'ADD_TYPE'] == 1:
                    X[i][10] = df_fadian.loc['datongpeiQ5200', 'chushi']-ADD_fadian
                else:
                    X[i][10] = X[i][10]
                if df_fadian.loc['datongpeiQ5000', 'ADD_TYPE'] == 1:
                    X[i][11] = df_fadian.loc['datongpeiQ5000', 'chushi']-ADD_fadian
                else:
                    X[i][11] = X[i][11]
                if df_fadian.loc['shenfuyuan', 'ADD_TYPE'] == 1:
                    X[i][12] = df_fadian.loc['shenfuyuan', 'chushi']-ADD_fadian
                else:
                    X[i][12] = X[i][12]
                if df_fadian.loc['shenfupei', 'ADD_TYPE'] == 1:
                    X[i][13] = df_fadian.loc['shenfupei', 'chushi']-ADD_fadian
                else:
                    X[i][13] = X[i][13]
                if df_fadian.loc['shenyou2', 'ADD_TYPE'] == 1:
                    X[i][14] = df_fadian.loc['shenyou2', 'chushi']-ADD_fadian
                else:
                    X[i][14] = X[i][14]
                if df_fadian.loc['shenwai3', 'ADD_TYPE'] == 1:
                    X[i][15] = df_fadian.loc['shenwai3', 'chushi']-ADD_fadian
                else:
                    X[i][15] = X[i][15]
            else:
                X[i][8] = df_fadian.loc['datongpeiQ5800', 'chushi']
                X[i][9] = df_fadian.loc['datongpeiQ5500', 'chushi']
                X[i][10] = df_fadian.loc['datongpeiQ5200', 'chushi']
                X[i][11] = df_fadian.loc['datongpeiQ5000', 'chushi']
                X[i][12] = df_fadian.loc['shenfuyuan', 'chushi']
                X[i][13] = df_fadian.loc['shenfupei', 'chushi']
                X[i][14] = df_fadian.loc['shenyou2', 'chushi']
                X[i][15] = df_fadian.loc['shenwai3', 'chushi']


            ADD_shaojie = X[i][16] * df_shaojie.loc['jiaozuo', 'TYPE'] + X[i][17] * df_shaojie.loc['jincheng', 'TYPE']
            ADD_TYPE_fadian_HAS_1= df_shaojie.loc['jiaozuo', 'ADD_TYPE']+ df_shaojie.loc['jincheng', 'ADD_TYPE']
            if ADD_TYPE_fadian_HAS_1 > 0:
                if df_shaojie.loc['jiaozuo', 'TYPE'] == 1:
                    X[i][16] = df_shaojie.loc['jiaozuo', 'chushi'] + X[i][16]
                else:
                    X[i][16] = df_shaojie.loc['jiaozuo', 'chushi']
                if df_shaojie.loc['jincheng', 'TYPE'] == 1:
                    X[i][17] = df_shaojie.loc['jincheng', 'chushi'] + X[i][17]
                else:
                    X[i][17] = df_shaojie.loc['jincheng', 'chushi']
                if df_shaojie.loc['jiaozuo', 'ADD_TYPE'] == 1:
                    X[i][16] = df_shaojie.loc['jiaozuo', 'chushi']-ADD_shaojie
                else:
                    X[i][16] = X[i][16]
                if df_shaojie.loc['jincheng', 'ADD_TYPE'] == 1:
                    X[i][17] = df_shaojie.loc['jincheng', 'chushi']-ADD_shaojie
                else:
                    X[i][17] = X[i][17]
            else:
                X[i][16] = df_shaojie.loc['jiaozuo', 'chushi']
                X[i][17] = df_shaojie.loc['jincheng', 'chushi']
            ['tizhijiaofen', 'dingzhilantan']
            ADD_gaolu = X[i][18] * df_gaolu.loc['tizhijiaofen', 'TYPE'] + X[i][19] * df_gaolu.loc['dingzhilantan', 'TYPE']
            ADD_TYPE_gaolu_HAS_1= df_gaolu.loc['tizhijiaofen', 'ADD_TYPE'] + df_gaolu.loc['dingzhilantan', 'ADD_TYPE']
            if ADD_TYPE_gaolu_HAS_1 > 0:
                if df_gaolu.loc['tizhijiaofen', 'TYPE'] == 1:
                    X[i][18] = df_gaolu.loc['tizhijiaofen', 'chushi'] + X[i][18]
                else:
                    X[i][18] = df_gaolu.loc['tizhijiaofen', 'chushi']
                if df_gaolu.loc['dingzhilantan', 'TYPE'] == 1:
                    X[i][19] = df_gaolu.loc['dingzhilantan', 'chushi'] + X[i][19]
                else:
                    X[i][19] = df_gaolu.loc['dingzhilantan', 'chushi']
                if df_gaolu.loc['tizhijiaofen', 'ADD_TYPE'] == 1:
                    X[i][18] = df_gaolu.loc['tizhijiaofen', 'chushi']-ADD_shaojie
                else:
                    X[i][18] = X[i][18]
                if df_gaolu.loc['dingzhilantan', 'ADD_TYPE'] == 1:
                    X[i][19] = df_gaolu.loc['dingzhilantan', 'chushi']-ADD_shaojie
                else:
                    X[i][19] = X[i][19]
            else:
                X[i][18] = df_gaolu.loc['tizhijiaofen', 'chushi']
                X[i][19] = df_gaolu.loc['dingzhilantan', 'chushi']


        # 初始化种群的各个粒子的速度
        V = np.random.uniform(-max_vel, max_vel, size=(size, dim))
        # 不等式约束
        constraint_ueq = (
            lambda x:  X[0] + X[1] + X[2] + X[3] + X[4] + X[5] + X[6] + X[7] + X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15] + X[16] + X[17] - (kongmeizhibiao - WT_lianjiaomei)
            ,
            lambda x: X[18] + X[19] + 0 - (tieshuichanliang * chunmeibi / 1000 - (100 - penchuimeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[0] + X[1] + X[2] + X[3] + X[4] + X[5] + X[6] + X[7])) / ((100 - lantanshuifen) / 100)
            ,
            lambda x: 0-(fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100 - 100 / (100 + meitanwushunlv) * (X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15])) / (100 / (100 + meitanwushunlv))
            ,
            lambda x: 0-((shaojiechanliang * shaojieranliaobi / 1000 - jiaotanchanliang * cujiaolv / 100 - WT_waigoujiaotan * waigoujiaofenlv / 100 * (100 - waigoujiaoshuifen) / 100) - (100 - shaojiemeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[16] + X[17]) ) / ((100 - shaojiejiaofenshuifen) / 100 )
            ,
            lambda x: (tieshuichanliang * chunmeibi / 1000 - (100 - penchuimeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[0] + X[1] + X[2] + X[3] + X[4] + X[5] + X[6] + X[7])) / ((100 - lantanshuifen) / 100) - X[18] - X[19] - gaizhilantan_penchui_kegongziyuan
            ,
            lambda x: ((shaojiechanliang * shaojieranliaobi / 1000 - jiaotanchanliang * cujiaolv / 100 - WT_waigoujiaotan * waigoujiaofenlv / 100 * (100 - waigoujiaoshuifen) / 100) - (100 - shaojiemeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[16] + X[17]) ) / ((100 - shaojiejiaofenshuifen) / 100 ) -shaojielantan_shaojie_kegongziyuan
            ,
            # lambda x: (p_re_min - pm1_re) * X[0] + (p_re_min - pm2_re) * X[1] + (p_re_min - pm3_re) * X[2] + (p_re_min - pm4_re) * X[3] + (p_re_min - pm5_re) * X[4] + (p_re_min - pm6_re) * X[5] + (p_re_min - pm7_re) * X[6] + (p_re_min - pm8_re) * X[7]
            # ,
            # lambda x: (d_re_min - dm1_re) * X[8] + (d_re_min - dm2_re) * X[9] + (d_re_min - dm3_re) * X[10] + (d_re_min - dm4_re) * X[11] + (d_re_min - dm5_re) * X[12] + (d_re_min - dm6_re) * X[13] + (d_re_min - dm7_re) * X[14] + (d_re_min - dm8_re) * X[15]
            # ,
            # lambda x: (s_re_min - sm1_re) * X[16] + (s_re_min-sm2_re) * X[17]
            # ,
            lambda x: x[5]+X[6]+X[7]-gaoping_zhaozhuang_yangquan2_penchui_kegongziyuan
            ,
            lambda x: 100*x[0]-p1_1_ratio_max*(x[0]+x[1]+x[2]+x[3]+x[4]+x[5]+x[6]+x[7]+((tieshuichanliang * chunmeibi / 1000 -  (100 - penchuimeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[0] + X[1] + X[2] + X[3] + X[4] + X[5] + X[6] + X[7])) / ( (100 - lantanshuifen) / 100)))
            ,
            lambda x: p1_1_ratio_min * (x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7] + ((tieshuichanliang * chunmeibi / 1000 - (100 - penchuimeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[0] +X[1] +X[2] +X[3] +X[4] +X[5] +X[6] +X[7])) / ((100 - lantanshuifen) / 100))) - 100 * x[0]
            ,
            lambda x: 100 * x[1] - p2_2_ratio_max * (x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7] + ((tieshuichanliang * chunmeibi / 1000 - (100 - penchuimeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[0] +X[1] +X[2] +X[3] +X[4] +X[5] +X[6] +X[7])) / ((100 - lantanshuifen) / 100)))
            ,
            lambda x: p2_2_ratio_max * (x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7] + ((tieshuichanliang * chunmeibi / 1000 - (
                                                                                                                 100 - penchuimeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[0] +X[1] +X[2] +X[3] +X[4] +X[5] +X[6] +X[7])) / (
                                                                                                             (100 - lantanshuifen) / 100))) - 100 *
                      x[1]
            ,
            lambda x: 100 * x[2] - p3_2_ratio_max * (x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7] + ((tieshuichanliang * chunmeibi / 1000 - (
                                                                                                                              100 - penchuimeishuifen) / 100 / (
                                                                                                                                      100 + meitanwushunlv) * 100 * (
                                                                                                                                      x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7])) / ((100 - lantanshuifen) / 100)))
            ,
            lambda x: p3_2_ratio_max * (x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7] + ((tieshuichanliang * chunmeibi / 1000 - (100 - penchuimeishuifen) / 100 / (
                                                                                                                         100 + meitanwushunlv) * 100 * (
                                                                                                                         x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7])) / ((100 - lantanshuifen) / 100))) - 100 * x[2]
            ,
            lambda x: 100 * x[3] - p4_2_ratio_max * (x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7] + ((tieshuichanliang * chunmeibi / 1000 - (
                                                                                                                              100 - penchuimeishuifen) / 100 / (
                                                                                                                                      100 + meitanwushunlv) * 100 * (
                                                                                                                                      x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7])) / (
                                                                                                                          (100 - lantanshuifen) / 100)))
            ,
            lambda x: p4_2_ratio_max * (x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7] + ((tieshuichanliang * chunmeibi / 1000 - (
                                                                                                                 100 - penchuimeishuifen) / 100 / (
                                                                                                                         100 + meitanwushunlv) * 100 * (
                                                                                                                         x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7])) / (
                                                                                                             (100 - lantanshuifen) / 100))) - 100 *x[3]
            ,
            lambda x: 100 * x[4] - p5_2_ratio_max * (x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7] + ((tieshuichanliang * chunmeibi / 1000 - (
                                                                                                                              100 - penchuimeishuifen) / 100 / (
                                                                                                                                      100 + meitanwushunlv) * 100 * (
                                                                                                                                      x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7])) / (
                                                                                                                          (100 - lantanshuifen) / 100)))
            ,
            lambda x: p5_2_ratio_max * (x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7] + ((tieshuichanliang * chunmeibi / 1000 - (100 - penchuimeishuifen) / 100 / (
                                                                                                                         100 + meitanwushunlv) * 100 * (
                                                                                                                         x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7])) / (
                                                                                                             (100 - lantanshuifen) / 100))) - 100 *x[4]
            ,
            lambda x: 100 * x[5] - p6_2_ratio_max * (x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7] + ((tieshuichanliang * chunmeibi / 1000 - (
                                                                                                                              100 - penchuimeishuifen) / 100 / (
                                                                                                                                      100 + meitanwushunlv) * 100 * (
                                                                                                                                      x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7])) / (
                                                                                                                          (100 - lantanshuifen) / 100)))
            ,
            lambda x: p6_2_ratio_max * (x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7] + ((tieshuichanliang * chunmeibi / 1000 - (
                                                                                                                 100 - penchuimeishuifen) / 100 / (
                                                                                                                         100 + meitanwushunlv) * 100 * (
                                                                                                                         x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7])) / (
                                                                                                             (100 - lantanshuifen) / 100))) - 100 *x[5]
            ,
            lambda x: 100 * x[6] - p7_2_ratio_max * (x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7] + ((tieshuichanliang * chunmeibi / 1000 - (
                                                                                                                              100 - penchuimeishuifen) / 100 / (
                                                                                                                                      100 + meitanwushunlv) * 100 * (
                                                                                                                                      x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7])) / (
                                                                                                                          ( 100 - lantanshuifen) / 100)))
            ,
            lambda x: p7_2_ratio_max * (x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7] + ((tieshuichanliang * chunmeibi / 1000 - (
                                                                                                                 100 - penchuimeishuifen) / 100 / (
                                                                                                                         100 + meitanwushunlv) * 100 * (
                                                                                                                         x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7])) / (
                                                                                                             (100 - lantanshuifen) / 100))) - 100 *x[6]
            ,
            lambda x: 100 * x[7] - p8_2_ratio_max * (x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7] + ((tieshuichanliang * chunmeibi / 1000 - (
                                                                                                                              100 - penchuimeishuifen) / 100 / (
                                                                                                                                      100 + meitanwushunlv) * 100 * (
                                                                                                                                      x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7])) / (
                                                                                                                          (100 - lantanshuifen) / 100)))
            ,
            lambda x: p8_2_ratio_max * (x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7] + ((tieshuichanliang * chunmeibi / 1000 - (
                                                                                                                 100 - penchuimeishuifen) / 100 / (
                                                                                                                         100 + meitanwushunlv) * 100 * (
                                                                                                                         x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7])) / (
                                                                                                             ( 100 - lantanshuifen) / 100))) - 100 *x[7]
            ,
            lambda x: 100 * x[1] - p_1_ratio_max * (x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7] + ((tieshuichanliang * chunmeibi / 1000 - (
                                                                                                                             100 - penchuimeishuifen) / 100 / (
                                                                                                                                     100 + meitanwushunlv) * 100 * (
                                                                                                                                     x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7])) / (
                                                                                                                         (100 - lantanshuifen) / 100)))
            ,
            lambda x: p_1_ratio_max * (x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7] + ((tieshuichanliang * chunmeibi / 1000 - (
                                                                                                                100 - penchuimeishuifen) / 100 / (
                                                                                                                        100 + meitanwushunlv) * 100 * (
                                                                                                                        x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7])) / (
                                                                                                            (100 - lantanshuifen) / 100))) - 100 *x[1]
            ,
            lambda x: 100 * (x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7]) - p_2_ratio_max * (x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7] + ((tieshuichanliang * chunmeibi / 1000 - (
                            100 - penchuimeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[0] + X[1] + X[2] + X[3] + X[4] + X[5] + X[6] + X[7])) / ((100 - lantanshuifen) / 100)))
            ,
            lambda x: p_2_ratio_min * (x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7] + ((tieshuichanliang * chunmeibi / 1000 - (
                                                                                                                100 - penchuimeishuifen) / 100 / (
                                                                                                                        100 + meitanwushunlv) * 100 * (
                                                                                                                        x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7])) / (
                                                                                                            (100 - lantanshuifen) / 100))) - 100 * (x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7])
            ,
            lambda x: 100 * ((tieshuichanliang * chunmeibi / 1000 - (100 - penchuimeishuifen) / 100 / (
                        100 + meitanwushunlv) * 100 * (X[0] + X[1] + X[2] + X[3] + X[4] + X[5] + X[6] + X[7])) / (
                                         (100 - lantanshuifen) / 100)) - p_3_ratio_max * (
                                  x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7] + ((tieshuichanliang * chunmeibi / 1000 - (
                                                                                                           100 - penchuimeishuifen) / 100 / (
                                                                                                                   100 + meitanwushunlv) * 100 * (
                                                                                                                   x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7])) / (
                                                                                                       (100 - lantanshuifen) / 100)))
            ,
            lambda x: p_3_ratio_min * (x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7] + ((tieshuichanliang * chunmeibi / 1000 - (
                                                                                                                100 - penchuimeishuifen) / 100 / (
                                                                                                                        100 + meitanwushunlv) * 100 * (
                                                                                                                        x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7])) / (
                                                                                                            (100 - lantanshuifen) / 100))) - 100 * (
                                  (tieshuichanliang * chunmeibi / 1000 - (100 - penchuimeishuifen) / 100 / (
                                              100 + meitanwushunlv) * 100 * (X[0] + X[1] + X[2] + X[3] + X[4] + X[5] + X[6] + X[7])) / ((100 - lantanshuifen) / 100))
            ,
            lambda x: 100 * x[18] - p10_3_ratio_max * (x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7] + ((tieshuichanliang * chunmeibi / 1000 - (
                                                                                                                                100 - penchuimeishuifen) / 100 / (
                                                                                                                                        100 + meitanwushunlv) * 100 * (
                                                                                                                                        x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7])) / (
                                                                                                                            (100 - lantanshuifen) / 100)))
            ,
            lambda x: p10_3_ratio_min * (x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7] + ((tieshuichanliang * chunmeibi / 1000 - (
                                                                                                                  100 - penchuimeishuifen) / 100 / (
                                                                                                                          100 + meitanwushunlv) * 100 * (
                                                                                                                          x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7])) / (
                                                                                                              (100 - lantanshuifen) / 100))) - 100 *x[18]
            ,
            lambda x: 100 * x[19] - p11_3_ratio_max * (x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7] + ((tieshuichanliang * chunmeibi / 1000 - (
                                                                                                                                100 - penchuimeishuifen) / 100 / (
                                                                                                                                        100 + meitanwushunlv) * 100 * (
                                                                                                                                        x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7])) / (
                                                                                                                            (100 - lantanshuifen) / 100)))
            ,
            lambda x: p11_3_ratio_min * (x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7] + ((tieshuichanliang * chunmeibi / 1000 - (
                                                                                                                  100 - penchuimeishuifen) / 100 / (
                                                                                                                          100 + meitanwushunlv) * 100 * (
                                                                                                                          x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7])) / (
                                                                                                              (100 - lantanshuifen) / 100))) - 100 *x[19]
            ,
            lambda x: 100 * (((tieshuichanliang * chunmeibi / 1000 - (100 - penchuimeishuifen) / 100 / (
                        100 + meitanwushunlv) * 100 * (X[0] + X[1] + X[2] + X[3] + X[4] + X[5] + X[6] + X[7])) / (
                                          (100 - lantanshuifen) / 100)) - x[18] - x[19]) - p9_3_ratio_max * (
                                  x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7] + ((tieshuichanliang * chunmeibi / 1000 - (100 - penchuimeishuifen) / 100 / (X[0] +X[1] + X[2] +X[3] + X[4] +X[5] + X[6] +
                                                                                                                   X[7])) / ((100 - lantanshuifen) / 100)))
            ,
            lambda x: p9_3_ratio_min * (x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7] + ((tieshuichanliang * chunmeibi / 1000 - (
                                                                                                                 100 - penchuimeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (
                                                                                                                         X[0] +X[1] +X[2] +X[3] +X[4] +X[5] +X[6] +X[7])) / ((100 - lantanshuifen) / 100))) - 100 * (
                                  ((tieshuichanliang * chunmeibi / 1000 - (100 - penchuimeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (
                                                X[0] + X[1] + X[2] + X[3] + X[4] + X[5] + X[6] + X[7])) / ((100 - lantanshuifen) / 100)) - x[18] - x[19])
            ,
            lambda x: 100 * x[8] - d1_1_ratio_max * (x[8] + x[9] + x[10] + x[11] + x[12] + x[13] + x[14] + x[15] + (
                        fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100 - 100 / (
                            100 + meitanwushunlv) * (X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15])) / (
                                                                 100 / (100 + meitanwushunlv)))
            ,
            lambda x: 100 * x[9] - d2_1_ratio_max * (x[8] + x[9] + x[10] + x[11] + x[12] + x[13] + x[14] + x[15] + (
                        fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100 - 100 / (
                            100 + meitanwushunlv) * (X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15])) / (
                                                                 100 / (100 + meitanwushunlv)))
            ,
            lambda x: 100 * x[10] - d3_1_ratio_max * (x[8] + x[9] + x[10] + x[11] + x[12] + x[13] + x[14] + x[15] + (
                        fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100 - 100 / (
                            100 + meitanwushunlv) * (X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15])) / (
                                                                  100 / (100 + meitanwushunlv)))
            ,
            lambda x: 100 * x[11] - d4_1_ratio_max * (x[8] + x[9] + x[10] + x[11] + x[12] + x[13] + x[14] + x[15] + (
                        fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100 - 100 / (
                            100 + meitanwushunlv) * (X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15])) / (
                                                                  100 / (100 + meitanwushunlv)))
            ,
            lambda x: 100 * x[12] - d5_2_ratio_max * (x[8] + x[9] + x[10] + x[11] + x[12] + x[13] + x[14] + x[15] + (
                        fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100 - 100 / (
                            100 + meitanwushunlv) * (X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15])) / (
                                                                  100 / (100 + meitanwushunlv)))
            ,
            lambda x: 100 * x[13] - d6_2_ratio_max * (x[8] + x[9] + x[10] + x[11] + x[12] + x[13] + x[14] + x[15] + (
                        fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100 - 100 / (
                            100 + meitanwushunlv) * (X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15])) / (
                                                                  100 / (100 + meitanwushunlv)))
            ,
            lambda x: 100 * x[14] - d7_2_ratio_max * (x[8] + x[9] + x[10] + x[11] + x[12] + x[13] + x[14] + x[15] + (
                        fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100 - 100 / (
                            100 + meitanwushunlv) * (X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15])) / (
                                                                  100 / (100 + meitanwushunlv)))
            ,
            lambda x: 100 * x[15] - d8_2_ratio_max * (x[8] + x[9] + x[10] + x[11] + x[12] + x[13] + x[14] + x[15] + (
                        fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100 - 100 / (
                            100 + meitanwushunlv) * (X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15])) / (
                                                                  100 / (100 + meitanwushunlv)))
            ,
            lambda x: 100 * ((fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100 - 100 / (
                        100 + meitanwushunlv) * (X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15])) / (
                                         100 / (100 + meitanwushunlv))) - d9_3_ratio_max * (
                                  x[8] + x[9] + x[10] + x[11] + x[12] + x[13] + x[14] + x[15] + (
                                      fadianliang * meidianbi / 100 * fadianmeihao / 100 * (
                                          100 + meitanwushunlv) / 100 - 100 / (100 + meitanwushunlv) * (
                                                  X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15])) / (100 / (
                                      100 + meitanwushunlv)))
            ,
            lambda x: 100 * ((fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100 - 100 / (
                        100 + meitanwushunlv) * (X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15])) / (
                                         100 / (100 + meitanwushunlv))) - d_3_ratio_max * (
                                  x[8] + x[9] + x[10] + x[11] + x[12] + x[13] + x[14] + x[15] + (
                                      fadianliang * meidianbi / 100 * fadianmeihao / 100 * (
                                          100 + meitanwushunlv) / 100 - 100 / (100 + meitanwushunlv) * (
                                                  X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15])) / (100 / (
                                      100 + meitanwushunlv)))
            ,
            lambda x: 100 * (x[8] + x[9] + x[10] + x[11]) - d_1_ratio_max * (
                        x[8] + x[9] + x[10] + x[11] + x[12] + x[13] + x[14] + x[15] + (
                            fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100 - 100 / (
                                100 + meitanwushunlv) * (X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15])) / (
                                                                                            100 / (100 + meitanwushunlv)))
            ,
            lambda x: 100 * (x[12] + x[13] + x[14] + x[15]) - d_2_ratio_max * (
                        x[8] + x[9] + x[10] + x[11] + x[12] + x[13] + x[14] + x[15] + (
                            fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100 - 100 / (
                                100 + meitanwushunlv) * (X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15])) / (
                                                                                            100 / (100 + meitanwushunlv)))
            ,
            lambda x: d1_1_ratio_min * (x[8] + x[9] + x[10] + x[11] + x[12] + x[13] + x[14] + x[15] + (
                        fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100 - 100 / (
                            100 + meitanwushunlv) * (X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15])) / (
                                                    100 / (100 + meitanwushunlv))) - 100 * x[8]
            ,
            lambda x: d2_1_ratio_min * (x[8] + x[9] + x[10] + x[11] + x[12] + x[13] + x[14] + x[15] + (
                        fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100 - 100 / (
                            100 + meitanwushunlv) * (X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15])) / (
                                                    100 / (100 + meitanwushunlv))) - 100 * x[9]
            ,
            lambda x: d3_1_ratio_min * (x[8] + x[9] + x[10] + x[11] + x[12] + x[13] + x[14] + x[15] + (
                        fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100 - 100 / (
                            100 + meitanwushunlv) * (X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15])) / (
                                                    100 / (100 + meitanwushunlv))) - 100 * x[10]
            ,
            lambda x: d4_1_ratio_min * (x[8] + x[9] + x[10] + x[11] + x[12] + x[13] + x[14] + x[15] + (
                        fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100 - 100 / (
                            100 + meitanwushunlv) * (X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15])) / (
                                                    100 / (100 + meitanwushunlv))) - 100 * x[11]
            ,
            lambda x: d5_2_ratio_min * (x[8] + x[9] + x[10] + x[11] + x[12] + x[13] + x[14] + x[15] + (
                        fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100 - 100 / (
                            100 + meitanwushunlv) * (X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15])) / (
                                                    100 / (100 + meitanwushunlv))) - 100 * x[12]
            ,
            lambda x: d6_2_ratio_min * (x[8] + x[9] + x[10] + x[11] + x[12] + x[13] + x[14] + x[15] + (
                        fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100 - 100 / (
                            100 + meitanwushunlv) * (X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15])) / (100 / (100 + meitanwushunlv))) - 100 * x[13]
            ,
            lambda x: d7_2_ratio_min * (x[8] + x[9] + x[10] + x[11] + x[12] + x[13] + x[14] + x[15] + (fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100 - 100 / (
                            100 + meitanwushunlv) * (X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15])) / (100 / (100 + meitanwushunlv))) - 100 * x[14]
            ,
            lambda x: d8_2_ratio_min * (x[8] + x[9] + x[10] + x[11] + x[12] + x[13] + x[14] + x[15] + (
                        fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100 - 100 / (100 + meitanwushunlv) * (X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15])) / ( 100 / (100 + meitanwushunlv))) - 100 * x[15]
            ,
            lambda x: d9_3_ratio_min * (x[8] + x[9] + x[10] + x[11] + x[12] + x[13] + x[14] + x[15] + (
                        fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100 - 100 / (100 + meitanwushunlv) * (X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15])) / (
                                                    100 / (100 + meitanwushunlv))) - 100 * ((fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100 - 100 / (100 + meitanwushunlv) * ( X[8] + X[9] + X[10] + X[11] +X[12] + X[13] +X[14] + X[15])) / (100 / (100 + meitanwushunlv)))
            ,
            lambda x: d_3_ratio_min * (x[8] + x[9] + x[10] + x[11] + x[12] + x[13] + x[14] + x[15] + (fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100 - 100 / (
                            100 + meitanwushunlv) * (X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15])) / (100 / (100 + meitanwushunlv))) - 100 * ((fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100 - 100 / (100 + meitanwushunlv) * (X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15])) / (100 / (100 + meitanwushunlv)))
            ,
            lambda x: d_1_ratio_min * (x[8] + x[9] + x[10] + x[11] + x[12] + x[13] + x[14] + x[15] + (fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100 - 100 / (
                            100 + meitanwushunlv) * (X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15])) / (100 / (100 + meitanwushunlv))) - 100 * (x[8] + x[9] + x[10] + x[11])
            ,
            lambda x: d_2_ratio_min * (x[8] + x[9] + x[10] + x[11] + x[12] + x[13] + x[14] + x[15] + (fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100 - 100 / (
                            100 + meitanwushunlv) * (X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15])) / (100 / (100 + meitanwushunlv))) - 100 * (x[12] + x[13] + x[14] + x[15])
            ,
            lambda x: 100 * x[16] - s1_1_ratio_max * (x[16] + x[17] + ((shaojiechanliang * shaojieranliaobi / 1000 - jiaotanchanliang * cujiaolv / 100 - WT_waigoujiaotan * waigoujiaofenlv / 100 * (
                                                                                       100 - waigoujiaoshuifen) / 100) - (100 - shaojiemeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (
                                                                                   X[16] + X[17])) / ((100 - shaojiejiaofenshuifen) / 100))
            ,
            lambda x: s1_1_ratio_min * (x[16] + x[17] + ((shaojiechanliang * shaojieranliaobi / 1000 - jiaotanchanliang * cujiaolv / 100 - WT_waigoujiaotan * waigoujiaofenlv / 100 * (
                                                                         100 - waigoujiaoshuifen) / 100) - (100 - shaojiemeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[16] + X[17])) / ((100 - shaojiejiaofenshuifen) / 100)) - 100 * x[16]
            ,
            lambda x: 100 * x[17] - s2_1_ratio_max * (x[16] + x[17] + ((shaojiechanliang * shaojieranliaobi / 1000 - jiaotanchanliang * cujiaolv / 100 - WT_waigoujiaotan * waigoujiaofenlv / 100 * (
                                                                                       100 - waigoujiaoshuifen) / 100) - (100 - shaojiemeishuifen) / 100 / (
                                                                                   100 + meitanwushunlv) * 100 * (X[16] + X[17])) / ((100 - shaojiejiaofenshuifen) / 100))
            ,
            lambda x: s2_1_ratio_min * (x[16] + x[17] + ((shaojiechanliang * shaojieranliaobi / 1000 - jiaotanchanliang * cujiaolv / 100 - WT_waigoujiaotan * waigoujiaofenlv / 100 * (
                                                                         100 - waigoujiaoshuifen) / 100) - (100 - shaojiemeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[16] + X[17])) / ((100 - shaojiejiaofenshuifen) / 100)) - 100 * x[17]
            ,
            lambda x: 100 * (x[16] + x[17]) - s_1_ratio_max * (x[16] + x[17] + ((shaojiechanliang * shaojieranliaobi / 1000 - jiaotanchanliang * cujiaolv / 100 - WT_waigoujiaotan * waigoujiaofenlv / 100 * (
                                                                                                100 - waigoujiaoshuifen) / 100) - (100 - shaojiemeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[16] + X[17])) / ((100 - shaojiejiaofenshuifen) / 100))
            ,
            lambda x: s_1_ratio_min * (x[16] + x[17] + ((shaojiechanliang * shaojieranliaobi / 1000 - jiaotanchanliang * cujiaolv / 100 - WT_waigoujiaotan * waigoujiaofenlv / 100 * (
                                                                        100 - waigoujiaoshuifen) / 100) - (100 - shaojiemeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[16] + X[17])) / (
                                                   (100 - shaojiejiaofenshuifen) / 100)) - 100 * (x[16] + x[17])
            ,
            lambda x: 100 * ((shaojiechanliang * shaojieranliaobi / 1000 - jiaotanchanliang * cujiaolv / 100 - WT_waigoujiaotan * waigoujiaofenlv / 100 * (
                                             100 - waigoujiaoshuifen) / 100) - (100 - shaojiemeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[16] + X[17])) / ((100 - shaojiejiaofenshuifen) / 100) - s3_2_ratio_max * (x[16] + x[17] + ((shaojiechanliang * shaojieranliaobi / 1000 - jiaotanchanliang * cujiaolv / 100 - WT_waigoujiaotan * waigoujiaofenlv / 100 * (
                                                                                                                            100 - waigoujiaoshuifen) / 100) - (100 - shaojiemeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[16] +X[17])) / ((100 - shaojiejiaofenshuifen) / 100))
            ,
            lambda x: s3_2_ratio_min * (x[16] + x[17] + ((shaojiechanliang * shaojieranliaobi / 1000 - jiaotanchanliang * cujiaolv / 100 - WT_waigoujiaotan * waigoujiaofenlv / 100 * (
                                                                         100 - waigoujiaoshuifen) / 100) - (100 - shaojiemeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[16] + X[17])) / ((100 - shaojiejiaofenshuifen) / 100)) - 100 * ((shaojiechanliang * shaojieranliaobi / 1000 - jiaotanchanliang * cujiaolv / 100 - WT_waigoujiaotan * waigoujiaofenlv / 100 * (
                                                                                                                   100 - waigoujiaoshuifen) / 100) - (100 - shaojiemeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[16] + X[17])) / ((100 - shaojiejiaofenshuifen) / 100)
            ,
            lambda x: 100 * ((shaojiechanliang * shaojieranliaobi / 1000 - jiaotanchanliang * cujiaolv / 100 - WT_waigoujiaotan * waigoujiaofenlv / 100 * (100 - waigoujiaoshuifen) / 100) - (100 - shaojiemeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[16] + X[17])) / (
                                  (100 - shaojiejiaofenshuifen) / 100) - s_2_ratio_max * (x[16] + x[17] + ((shaojiechanliang * shaojieranliaobi / 1000 - jiaotanchanliang * cujiaolv / 100 - WT_waigoujiaotan * waigoujiaofenlv / 100 * (100 - waigoujiaoshuifen) / 100) - (100 - shaojiemeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[16] +X[17])) / ((100 - shaojiejiaofenshuifen) / 100))
            ,
            lambda x: s_2_ratio_min * (x[16] + x[17] + ((shaojiechanliang * shaojieranliaobi / 1000 - jiaotanchanliang * cujiaolv / 100 - WT_waigoujiaotan * waigoujiaofenlv / 100 * (100 - waigoujiaoshuifen) / 100) - (100 - shaojiemeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[16] + X[17])) / ((100 - shaojiejiaofenshuifen) / 100)) - 100 * ((shaojiechanliang * shaojieranliaobi / 1000 - jiaotanchanliang * cujiaolv / 100 - WT_waigoujiaotan * waigoujiaofenlv / 100 * (
                                                                                                                  100 - waigoujiaoshuifen) / 100) - (100 - shaojiemeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[16] + X[17])) / ((100 - shaojiejiaofenshuifen) / 100)
            ,
            lambda x: pm1_shui*x[0]+pm2_shui*x[1]+pm3_shui*x[2]+pm4_shui*x[3]+pm5_shui*x[4]+pm6_shui*x[5]+pm7_shui*x[6]+pm8_shui*x[7]+pl2_shui*x[18]+pl3_shui*x[19]+pl1_shui*((tieshuichanliang * chunmeibi / 1000 - (100 - penchuimeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[0] + X[1] + X[2] + X[3] + X[4] + X[5] + X[6] + X[7])) / ((100 - lantanshuifen) / 100)-X[18]-X[19])
            -p_shui_max*(x[0]+x[1]+x[2]+x[3]+x[4]+x[5]+x[6]+x[7]+(tieshuichanliang * chunmeibi / 1000 - (100 - penchuimeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[0] + X[1] + X[2] + X[3] + X[4] + X[5] + X[6] + X[7])) / ((100 - lantanshuifen) / 100))
            ,
            lambda x: p_shui_min*(x[0]+x[1]+x[2]+x[3]+x[4]+x[5]+x[6]+x[7]+(tieshuichanliang * chunmeibi / 1000 - (100 - penchuimeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[0] + X[1] + X[2] + X[3] + X[4] + X[5] + X[6] + X[7])) / ((100 - lantanshuifen) / 100))-
            (pm1_shui*x[0]+pm2_shui*x[1]+pm3_shui*x[2]+pm4_shui*x[3]+pm5_shui*x[4]+pm6_shui*x[5]+pm7_shui*x[6]+pm8_shui*x[7]+pl2_shui*x[18]+pl3_shui*x[19]+pl1_shui*((tieshuichanliang * chunmeibi / 1000 - (100 - penchuimeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[0] + X[1] + X[2] + X[3] + X[4] + X[5] + X[6] + X[7])) / ((100 - lantanshuifen) / 100)-X[18]-X[19]))
            ,
            lambda x: pm1_hui*x[0]+pm2_hui*x[1]+pm3_hui*x[2]+pm4_hui*x[3]+pm5_hui*x[4]+pm6_hui*x[5]+pm7_hui*x[6]+pm8_hui*x[7]+pl2_hui*x[18]+pl3_hui*x[19]+pl1_hui*((tieshuichanliang * chunmeibi / 1000 - (100 - penchuimeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[0] + X[1] + X[2] + X[3] + X[4] + X[5] + X[6] + X[7])) / ((100 - lantanshuifen) / 100)-X[18]-X[19])
            -p_hui_max*(x[0]+x[1]+x[2]+x[3]+x[4]+x[5]+x[6]+x[7]+(tieshuichanliang * chunmeibi / 1000 - (100 - penchuimeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[0] + X[1] + X[2] + X[3] + X[4] + X[5] + X[6] + X[7])) / ((100 - lantanshuifen) / 100))
            ,
            lambda x: p_hui_min*(x[0]+x[1]+x[2]+x[3]+x[4]+x[5]+x[6]+x[7]+(tieshuichanliang * chunmeibi / 1000 - (100 - penchuimeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[0] + X[1] + X[2] + X[3] + X[4] + X[5] + X[6] + X[7])) / ((100 - lantanshuifen) / 100))-
            (pm1_hui*x[0]+pm2_hui*x[1]+pm3_hui*x[2]+pm4_hui*x[3]+pm5_hui*x[4]+pm6_hui*x[5]+pm7_hui*x[6]+pm8_hui*x[7]+pl2_hui*x[18]+pl3_hui*x[19]+pl1_hui*((tieshuichanliang * chunmeibi / 1000 - (100 - penchuimeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[0] + X[1] + X[2] + X[3] + X[4] + X[5] + X[6] + X[7])) / ((100 - lantanshuifen) / 100)-X[18]-X[19]))
            ,
            lambda x: pm1_huifa*x[0]+pm2_huifa*x[1]+pm3_huifa*x[2]+pm4_huifa*x[3]+pm5_huifa*x[4]+pm6_huifa*x[5]+pm7_huifa*x[6]+pm8_huifa*x[7]+pl2_huifa*x[18]+pl3_huifa*x[19]+pl1_huifa*((tieshuichanliang * chunmeibi / 1000 - (100 - penchuimeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[0] + X[1] + X[2] + X[3] + X[4] + X[5] + X[6] + X[7])) / ((100 - lantanshuifen) / 100)-X[18]-X[19])
            -p_huifa_max*(x[0]+x[1]+x[2]+x[3]+x[4]+x[5]+x[6]+x[7]+(tieshuichanliang * chunmeibi / 1000 - (100 - penchuimeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[0] + X[1] + X[2] + X[3] + X[4] + X[5] + X[6] + X[7])) / ((100 - lantanshuifen) / 100))
            ,
            lambda x: p_huifa_min*(x[0]+x[1]+x[2]+x[3]+x[4]+x[5]+x[6]+x[7]+(tieshuichanliang * chunmeibi / 1000 - (100 - penchuimeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[0] + X[1] + X[2] + X[3] + X[4] + X[5] + X[6] + X[7])) / ((100 - lantanshuifen) / 100))-
            (pm1_huifa*x[0]+pm2_huifa*x[1]+pm3_huifa*x[2]+pm4_huifa*x[3]+pm5_huifa*x[4]+pm6_huifa*x[5]+pm7_huifa*x[6]+pm8_huifa*x[7]+pl2_huifa*x[18]+pl3_huifa*x[19]+pl1_huifa*((tieshuichanliang * chunmeibi / 1000 - (100 - penchuimeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[0] + X[1] + X[2] + X[3] + X[4] + X[5] + X[6] + X[7])) / ((100 - lantanshuifen) / 100)-X[18]-X[19]))
            ,
            lambda x: pm1_liu*x[0]+pm2_liu*x[1]+pm3_liu*x[2]+pm4_liu*x[3]+pm5_liu*x[4]+pm6_liu*x[5]+pm7_liu*x[6]+pm8_liu*x[7]+pl2_liu*x[18]+pl3_liu*x[19]+pl1_liu*((tieshuichanliang * chunmeibi / 1000 - (100 - penchuimeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[0] + X[1] + X[2] + X[3] + X[4] + X[5] + X[6] + X[7])) / ((100 - lantanshuifen) / 100)-X[18]-X[19])
            -p_liu_max*(x[0]+x[1]+x[2]+x[3]+x[4]+x[5]+x[6]+x[7]+(tieshuichanliang * chunmeibi / 1000 - (100 - penchuimeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[0] + X[1] + X[2] + X[3] + X[4] + X[5] + X[6] + X[7])) / ((100 - lantanshuifen) / 100))
            ,
            lambda x: p_liu_min*(x[0]+x[1]+x[2]+x[3]+x[4]+x[5]+x[6]+x[7]+(tieshuichanliang * chunmeibi / 1000 - (100 - penchuimeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[0] + X[1] + X[2] + X[3] + X[4] + X[5] + X[6] + X[7])) / ((100 - lantanshuifen) / 100))-
            (pm1_liu*x[0]+pm2_liu*x[1]+pm3_liu*x[2]+pm4_liu*x[3]+pm5_liu*x[4]+pm6_liu*x[5]+pm7_liu*x[6]+pm8_liu*x[7]+pl2_liu*x[18]+pl3_liu*x[19]+pl1_liu*((tieshuichanliang * chunmeibi / 1000 - (100 - penchuimeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[0] + X[1] + X[2] + X[3] + X[4] + X[5] + X[6] + X[7])) / ((100 - lantanshuifen) / 100)-X[18]-X[19]))
            ,
            lambda x: pm1_gu*x[0]+pm2_gu*x[1]+pm3_gu*x[2]+pm4_gu*x[3]+pm5_gu*x[4]+pm6_gu*x[5]+pm7_gu*x[6]+pm8_gu*x[7]+pl2_gu*x[18]+pl3_gu*x[19]+pl1_gu*((tieshuichanliang * chunmeibi / 1000 - (100 - penchuimeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[0] + X[1] + X[2] + X[3] + X[4] + X[5] + X[6] + X[7])) / ((100 - lantanshuifen) / 100)-X[18]-X[19])
            -p_gu_max*(x[0]+x[1]+x[2]+x[3]+x[4]+x[5]+x[6]+x[7]+(tieshuichanliang * chunmeibi / 1000 - (100 - penchuimeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[0] + X[1] + X[2] + X[3] + X[4] + X[5] + X[6] + X[7])) / ((100 - lantanshuifen) / 100))
            ,
            lambda x: p_gu_min*(x[0]+x[1]+x[2]+x[3]+x[4]+x[5]+x[6]+x[7]+(tieshuichanliang * chunmeibi / 1000 - (100 - penchuimeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[0] + X[1] + X[2] + X[3] + X[4] + X[5] + X[6] + X[7])) / ((100 - lantanshuifen) / 100))-
            (pm1_gu*x[0]+pm2_gu*x[1]+pm3_gu*x[2]+pm4_gu*x[3]+pm5_gu*x[4]+pm6_gu*x[5]+pm7_gu*x[6]+pm8_gu*x[7]+pl2_gu*x[18]+pl3_gu*x[19]+pl1_gu*((tieshuichanliang * chunmeibi / 1000 - (100 - penchuimeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[0] + X[1] + X[2] + X[3] + X[4] + X[5] + X[6] + X[7])) / ((100 - lantanshuifen) / 100)-X[18]-X[19]))
            ,
            lambda x: pm1_mo*x[0]+pm2_mo*x[1]+pm3_mo*x[2]+pm4_mo*x[3]+pm5_mo*x[4]+pm6_mo*x[5]+pm7_mo*x[6]+pm8_mo*x[7]+pl2_mo*x[18]+pl3_mo*x[19]+pl1_mo*((tieshuichanliang * chunmeibi / 1000 - (100 - penchuimeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[0] + X[1] + X[2] + X[3] + X[4] + X[5] + X[6] + X[7])) / ((100 - lantanshuifen) / 100)-X[18]-X[19])
            -p_mo_max*(x[0]+x[1]+x[2]+x[3]+x[4]+x[5]+x[6]+x[7]+(tieshuichanliang * chunmeibi / 1000 - (100 - penchuimeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[0] + X[1] + X[2] + X[3] + X[4] + X[5] + X[6] + X[7])) / ((100 - lantanshuifen) / 100))
            ,
            lambda x: p_mo_min*(x[0]+x[1]+x[2]+x[3]+x[4]+x[5]+x[6]+x[7]+(tieshuichanliang * chunmeibi / 1000 - (100 - penchuimeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[0] + X[1] + X[2] + X[3] + X[4] + X[5] + X[6] + X[7])) / ((100 - lantanshuifen) / 100))-
            (pm1_mo*x[0]+pm2_mo*x[1]+pm3_mo*x[2]+pm4_mo*x[3]+pm5_mo*x[4]+pm6_mo*x[5]+pm7_mo*x[6]+pm8_mo*x[7]+pl2_mo*x[18]+pl3_mo*x[19]+pl1_mo*((tieshuichanliang * chunmeibi / 1000 - (100 - penchuimeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[0] + X[1] + X[2] + X[3] + X[4] + X[5] + X[6] + X[7])) / ((100 - lantanshuifen) / 100)-X[18]-X[19]))
            ,
            lambda x: pm1_re*x[0]+pm2_re*x[1]+pm3_re*x[2]+pm4_re*x[3]+pm5_re*x[4]+pm6_re*x[5]+pm7_re*x[6]+pm8_re*x[7]+pl2_re*x[18]+pl3_re*x[19]+pl1_re*((tieshuichanliang * chunmeibi / 1000 - (100 - penchuimeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[0] + X[1] + X[2] + X[3] + X[4] + X[5] + X[6] + X[7])) / ((100 - lantanshuifen) / 100)-X[18]-X[19])
            -p_re_max*(x[0]+x[1]+x[2]+x[3]+x[4]+x[5]+x[6]+x[7]+(tieshuichanliang * chunmeibi / 1000 - (100 - penchuimeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[0] + X[1] + X[2] + X[3] + X[4] + X[5] + X[6] + X[7])) / ((100 - lantanshuifen) / 100))
            ,
            lambda x: p_re_min*(x[0]+x[1]+x[2]+x[3]+x[4]+x[5]+x[6]+x[7]+(tieshuichanliang * chunmeibi / 1000 - (100 - penchuimeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[0] + X[1] + X[2] + X[3] + X[4] + X[5] + X[6] + X[7])) / ((100 - lantanshuifen) / 100))-
            (pm1_re*x[0]+pm2_re*x[1]+pm3_re*x[2]+pm4_re*x[3]+pm5_re*x[4]+pm6_re*x[5]+pm7_re*x[6]+pm8_re*x[7]+pl2_re*x[18]+pl3_re*x[19]+pl1_re*((tieshuichanliang * chunmeibi / 1000 - (100 - penchuimeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[0] + X[1] + X[2] + X[3] + X[4] + X[5] + X[6] + X[7])) / ((100 - lantanshuifen) / 100)-X[18]-X[19]))
            ,
            lambda x: pm1_c*x[0]+pm2_c*x[1]+pm3_c*x[2]+pm4_c*x[3]+pm5_c*x[4]+pm6_c*x[5]+pm7_c*x[6]+pm8_c*x[7]+pl2_c*x[18]+pl3_c*x[19]+pl1_c*((tieshuichanliang * chunmeibi / 1000 - (100 - penchuimeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[0] + X[1] + X[2] + X[3] + X[4] + X[5] + X[6] + X[7])) / ((100 - lantanshuifen) / 100)-X[18]-X[19])
            -p_c_max*(x[0]+x[1]+x[2]+x[3]+x[4]+x[5]+x[6]+x[7]+(tieshuichanliang * chunmeibi / 1000 - (100 - penchuimeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[0] + X[1] + X[2] + X[3] + X[4] + X[5] + X[6] + X[7])) / ((100 - lantanshuifen) / 100))
            ,
            lambda x: p_c_min*(x[0]+x[1]+x[2]+x[3]+x[4]+x[5]+x[6]+x[7]+(tieshuichanliang * chunmeibi / 1000 - (100 - penchuimeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[0] + X[1] + X[2] + X[3] + X[4] + X[5] + X[6] + X[7])) / ((100 - lantanshuifen) / 100))-
            (pm1_c*x[0]+pm2_c*x[1]+pm3_c*x[2]+pm4_c*x[3]+pm5_c*x[4]+pm6_c*x[5]+pm7_c*x[6]+pm8_c*x[7]+pl2_c*x[18]+pl3_c*x[19]+pl1_c*((tieshuichanliang * chunmeibi / 1000 - (100 - penchuimeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[0] + X[1] + X[2] + X[3] + X[4] + X[5] + X[6] + X[7])) / ((100 - lantanshuifen) / 100)-X[18]-X[19]))
            ,
            lambda x: dm1_shui*x[8]+dm2_shui*x[9]+dm3_shui*x[10]+dm4_shui*x[11]+dm5_shui*x[12]+dm6_shui*x[13]+dl1_shui*((fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100 - 100 / (100 + meitanwushunlv) * (X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15]) ) / (100 / (100 + meitanwushunlv)))
            -d_shui_max*(x[8]+x[9]+x[10]+x[11]+x[12]+x[13]+(fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100 - 100 / (100 + meitanwushunlv) * (X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15]) ) / (100 / (100 + meitanwushunlv)))
            ,
            lambda x: d_shui_min*(x[8]+x[9]+x[10]+x[11]+x[12]+x[13]+(fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100 - 100 / (100 + meitanwushunlv) * (X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15]) ) / (100 / (100 + meitanwushunlv)))-
            (dm1_shui*x[8]+dm2_shui*x[9]+dm3_shui*x[10]+dm4_shui*x[11]+dm5_shui*x[12]+dm6_shui*x[13]+dl1_shui*((fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100 - 100 / (100 + meitanwushunlv) * (X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15]) ) / (100 / (100 + meitanwushunlv))))
            ,
            lambda x: dm1_hui*x[8]+dm2_hui*x[9]+dm3_hui*x[10]+dm4_hui*x[11]+dm5_hui*x[12]+dm6_hui*x[13]+dl1_hui*((fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100 - 100 / (100 + meitanwushunlv) * (X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15]) ) / (100 / (100 + meitanwushunlv)))
            -d_hui_max*(x[8]+x[9]+x[10]+x[11]+x[12]+x[13]+(fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100 - 100 / (100 + meitanwushunlv) * (X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15]) ) / (100 / (100 + meitanwushunlv)))
            ,
            lambda x: d_hui_min*(x[8]+x[9]+x[10]+x[11]+x[12]+x[13]+(fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100 - 100 / (100 + meitanwushunlv) * (X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15]) ) / (100 / (100 + meitanwushunlv)))-
            (dm1_hui*x[8]+dm2_hui*x[9]+dm3_hui*x[10]+dm4_hui*x[11]+dm5_hui*x[12]+dm6_hui*x[13]+dl1_hui*((fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100 - 100 / (100 + meitanwushunlv) * (X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15]) ) / (100 / (100 + meitanwushunlv))))
            ,
            lambda x: dm1_huifa*x[8]+dm2_huifa*x[9]+dm3_huifa*x[10]+dm4_huifa*x[11]+dm5_huifa*x[12]+dm6_huifa*x[13]+dl1_huifa*((fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100 - 100 / (100 + meitanwushunlv) * (X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15]) ) / (100 / (100 + meitanwushunlv)))
            -d_huifa_max*(x[8]+x[9]+x[10]+x[11]+x[12]+x[13]+(fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100 - 100 / (100 + meitanwushunlv) * (X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15]) ) / (100 / (100 + meitanwushunlv)))
            ,
            lambda x: d_huifa_min*(x[8]+x[9]+x[10]+x[11]+x[12]+x[13]+(fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100 - 100 / (100 + meitanwushunlv) * (X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15]) ) / (100 / (100 + meitanwushunlv)))-
            (dm1_huifa*x[8]+dm2_huifa*x[9]+dm3_huifa*x[10]+dm4_huifa*x[11]+dm5_huifa*x[12]+dm6_huifa*x[13]+dl1_huifa*((fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100 - 100 / (100 + meitanwushunlv) * (X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15]) ) / (100 / (100 + meitanwushunlv))))
            ,
            lambda x: dm1_liu*x[8]+dm2_liu*x[9]+dm3_liu*x[10]+dm4_liu*x[11]+dm5_liu*x[12]+dm6_liu*x[13]+dl1_liu*((fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100 - 100 / (100 + meitanwushunlv) * (X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15]) ) / (100 / (100 + meitanwushunlv)))
            -d_liu_max*(x[8]+x[9]+x[10]+x[11]+x[12]+x[13]+(fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100 - 100 / (100 + meitanwushunlv) * (X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15]) ) / (100 / (100 + meitanwushunlv)))
            ,
            lambda x: d_liu_min*(x[8]+x[9]+x[10]+x[11]+x[12]+x[13]+(fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100 - 100 / (100 + meitanwushunlv) * (X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15]) ) / (100 / (100 + meitanwushunlv)))-
            (dm1_liu*x[8]+dm2_liu*x[9]+dm3_liu*x[10]+dm4_liu*x[11]+dm5_liu*x[12]+dm6_liu*x[13]+dl1_liu*((fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100 - 100 / (100 + meitanwushunlv) * (X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15]) ) / (100 / (100 + meitanwushunlv))))
            ,
            lambda x: dm1_gu*x[8]+dm2_gu*x[9]+dm3_gu*x[10]+dm4_gu*x[11]+dm5_gu*x[12]+dm6_gu*x[13]+dl1_gu*((fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100 - 100 / (100 + meitanwushunlv) * (X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15]) ) / (100 / (100 + meitanwushunlv)))
            -d_gu_max*(x[8]+x[9]+x[10]+x[11]+x[12]+x[13]+(fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100 - 100 / (100 + meitanwushunlv) * (X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15]) ) / (100 / (100 + meitanwushunlv)))
            ,
            lambda x: d_gu_min*(x[8]+x[9]+x[10]+x[11]+x[12]+x[13]+(fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100 - 100 / (100 + meitanwushunlv) * (X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15]) ) / (100 / (100 + meitanwushunlv)))-
            (dm1_gu*x[8]+dm2_gu*x[9]+dm3_gu*x[10]+dm4_gu*x[11]+dm5_gu*x[12]+dm6_gu*x[13]+dl1_gu*((fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100 - 100 / (100 + meitanwushunlv) * (X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15]) ) / (100 / (100 + meitanwushunlv))))
            ,
            lambda x: dm1_re*x[8]+dm2_re*x[9]+dm3_re*x[10]+dm4_re*x[11]+dm5_re*x[12]+dm6_re*x[13]+dm7_re*x[14]+dm8_re*x[15]+dl1_re*((fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100 - 100 / (100 + meitanwushunlv) * (X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15]) ) / (100 / (100 + meitanwushunlv)))
            -d_re_max*(x[8]+x[9]+x[10]+x[11]+x[12]+x[13]+x[14]+x[15]+(fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100 - 100 / (100 + meitanwushunlv) * (X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15]) ) / (100 / (100 + meitanwushunlv)))
            ,
            lambda x: d_re_min*(x[8]+x[9]+x[10]+x[11]+x[12]+x[13]+x[14]+x[15]+(fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100 - 100 / (100 + meitanwushunlv) * (X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15]) ) / (100 / (100 + meitanwushunlv)))-
            (dm1_re*x[8]+dm2_re*x[9]+dm3_re*x[10]+dm4_re*x[11]+dm5_re*x[12]+dm6_re*x[13]+dm7_re*x[14]+dm8_re*x[15]+dl1_re*((fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100 - 100 / (100 + meitanwushunlv) * (X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15]) ) / (100 / (100 + meitanwushunlv))))
            ,
            lambda x: dm1_c*x[8]+dm2_c*x[9]+dm3_c*x[10]+dm4_c*x[11]+dm5_c*x[12]+dm6_c*x[13]+dl1_c*((fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100 - 100 / (100 + meitanwushunlv) * (X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15]) ) / (100 / (100 + meitanwushunlv)))
            -d_c_max*(x[8]+x[9]+x[10]+x[11]+x[12]+x[13]+(fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100 - 100 / (100 + meitanwushunlv) * (X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15]) ) / (100 / (100 + meitanwushunlv)))
            ,
            lambda x: d_c_min*(x[8]+x[9]+x[10]+x[11]+x[12]+x[13]+(fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100 - 100 / (100 + meitanwushunlv) * (X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15]) ) / (100 / (100 + meitanwushunlv)))-
            (dm1_c*x[8]+dm2_c*x[9]+dm3_c*x[10]+dm4_c*x[11]+dm5_c*x[12]+dm6_c*x[13]+dl1_c*((fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100 - 100 / (100 + meitanwushunlv) * (X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15]) ) / (100 / (100 + meitanwushunlv))))
            ,
                    lambda x: sm1_shui*x[16]+sm2_shui*x[17]+sl1_shui*(((shaojiechanliang * shaojieranliaobi / 1000 - jiaotanchanliang * cujiaolv / 100 - WT_waigoujiaotan * waigoujiaofenlv / 100 * (100 - waigoujiaoshuifen) / 100) - (100 - shaojiemeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[16] + X[17]) ) / ((100 - shaojiejiaofenshuifen) / 100 ))
            -s_shui_max*(x[16]+x[17]+((shaojiechanliang * shaojieranliaobi / 1000 - jiaotanchanliang * cujiaolv / 100 - WT_waigoujiaotan * waigoujiaofenlv / 100 * (100 - waigoujiaoshuifen) / 100) - (100 - shaojiemeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[16] + X[17]) ) / ((100 - shaojiejiaofenshuifen) / 100 ))
            ,
            lambda x: s_shui_min*(x[16]+x[17]+((shaojiechanliang * shaojieranliaobi / 1000 - jiaotanchanliang * cujiaolv / 100 - WT_waigoujiaotan * waigoujiaofenlv / 100 * (100 - waigoujiaoshuifen) / 100) - (100 - shaojiemeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[16] + X[17]) ) / ((100 - shaojiejiaofenshuifen) / 100 ))-
            (sm1_shui*x[16]+sm2_shui*x[17]+sl1_shui*(((shaojiechanliang * shaojieranliaobi / 1000 - jiaotanchanliang * cujiaolv / 100 - WT_waigoujiaotan * waigoujiaofenlv / 100 * (100 - waigoujiaoshuifen) / 100) - (100 - shaojiemeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[16] + X[17]) ) / ((100 - shaojiejiaofenshuifen) / 100 )))
            ,
            lambda x: sm1_hui*x[16]+sm2_hui*x[17]+sl1_hui*(((shaojiechanliang * shaojieranliaobi / 1000 - jiaotanchanliang * cujiaolv / 100 - WT_waigoujiaotan * waigoujiaofenlv / 100 * (100 - waigoujiaoshuifen) / 100) - (100 - shaojiemeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[16] + X[17]) ) / ((100 - shaojiejiaofenshuifen) / 100 ))
            -s_hui_max*(x[16]+x[17]+((shaojiechanliang * shaojieranliaobi / 1000 - jiaotanchanliang * cujiaolv / 100 - WT_waigoujiaotan * waigoujiaofenlv / 100 * (100 - waigoujiaoshuifen) / 100) - (100 - shaojiemeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[16] + X[17]) ) / ((100 - shaojiejiaofenshuifen) / 100 ))
            ,
            lambda x: s_hui_min*(x[16]+x[17]+((shaojiechanliang * shaojieranliaobi / 1000 - jiaotanchanliang * cujiaolv / 100 - WT_waigoujiaotan * waigoujiaofenlv / 100 * (100 - waigoujiaoshuifen) / 100) - (100 - shaojiemeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[16] + X[17]) ) / ((100 - shaojiejiaofenshuifen) / 100 ))-
            (sm1_hui*x[16]+sm2_hui*x[17]+sl1_hui*(((shaojiechanliang * shaojieranliaobi / 1000 - jiaotanchanliang * cujiaolv / 100 - WT_waigoujiaotan * waigoujiaofenlv / 100 * (100 - waigoujiaoshuifen) / 100) - (100 - shaojiemeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[16] + X[17]) ) / ((100 - shaojiejiaofenshuifen) / 100 )))
            ,
            lambda x: sm1_huifa*x[16]+sm2_huifa*x[17]+sl1_huifa*(((shaojiechanliang * shaojieranliaobi / 1000 - jiaotanchanliang * cujiaolv / 100 - WT_waigoujiaotan * waigoujiaofenlv / 100 * (100 - waigoujiaoshuifen) / 100) - (100 - shaojiemeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[16] + X[17]) ) / ((100 - shaojiejiaofenshuifen) / 100 ))
            -s_huifa_max*(x[16]+x[17]+((shaojiechanliang * shaojieranliaobi / 1000 - jiaotanchanliang * cujiaolv / 100 - WT_waigoujiaotan * waigoujiaofenlv / 100 * (100 - waigoujiaoshuifen) / 100) - (100 - shaojiemeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[16] + X[17]) ) / ((100 - shaojiejiaofenshuifen) / 100 ))
            ,
            lambda x: s_huifa_min*(x[16]+x[17]+((shaojiechanliang * shaojieranliaobi / 1000 - jiaotanchanliang * cujiaolv / 100 - WT_waigoujiaotan * waigoujiaofenlv / 100 * (100 - waigoujiaoshuifen) / 100) - (100 - shaojiemeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[16] + X[17]) ) / ((100 - shaojiejiaofenshuifen) / 100 ))-
            (sm1_huifa*x[16]+sm2_huifa*x[17]+sl1_huifa*(((shaojiechanliang * shaojieranliaobi / 1000 - jiaotanchanliang * cujiaolv / 100 - WT_waigoujiaotan * waigoujiaofenlv / 100 * (100 - waigoujiaoshuifen) / 100) - (100 - shaojiemeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[16] + X[17]) ) / ((100 - shaojiejiaofenshuifen) / 100 )))
            ,
            lambda x: sm1_liu*x[16]+sm2_liu*x[17]+sl1_liu*(((shaojiechanliang * shaojieranliaobi / 1000 - jiaotanchanliang * cujiaolv / 100 - WT_waigoujiaotan * waigoujiaofenlv / 100 * (100 - waigoujiaoshuifen) / 100) - (100 - shaojiemeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[16] + X[17]) ) / ((100 - shaojiejiaofenshuifen) / 100 ))
            -s_liu_max*(x[16]+x[17]+((shaojiechanliang * shaojieranliaobi / 1000 - jiaotanchanliang * cujiaolv / 100 - WT_waigoujiaotan * waigoujiaofenlv / 100 * (100 - waigoujiaoshuifen) / 100) - (100 - shaojiemeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[16] + X[17]) ) / ((100 - shaojiejiaofenshuifen) / 100 ))
            ,
            lambda x: s_liu_min*(x[16]+x[17]+((shaojiechanliang * shaojieranliaobi / 1000 - jiaotanchanliang * cujiaolv / 100 - WT_waigoujiaotan * waigoujiaofenlv / 100 * (100 - waigoujiaoshuifen) / 100) - (100 - shaojiemeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[16] + X[17]) ) / ((100 - shaojiejiaofenshuifen) / 100 ))-
            (sm1_liu*x[16]+sm2_liu*x[17]+sl1_liu*(((shaojiechanliang * shaojieranliaobi / 1000 - jiaotanchanliang * cujiaolv / 100 - WT_waigoujiaotan * waigoujiaofenlv / 100 * (100 - waigoujiaoshuifen) / 100) - (100 - shaojiemeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[16] + X[17]) ) / ((100 - shaojiejiaofenshuifen) / 100 )))
            ,
            lambda x: sm1_gu*x[16]+sm2_gu*x[17]+sl1_gu*(((shaojiechanliang * shaojieranliaobi / 1000 - jiaotanchanliang * cujiaolv / 100 - WT_waigoujiaotan * waigoujiaofenlv / 100 * (100 - waigoujiaoshuifen) / 100) - (100 - shaojiemeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[16] + X[17]) ) / ((100 - shaojiejiaofenshuifen) / 100 ))
            -s_gu_max*(x[16]+x[17]+((shaojiechanliang * shaojieranliaobi / 1000 - jiaotanchanliang * cujiaolv / 100 - WT_waigoujiaotan * waigoujiaofenlv / 100 * (100 - waigoujiaoshuifen) / 100) - (100 - shaojiemeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[16] + X[17]) ) / ((100 - shaojiejiaofenshuifen) / 100 ))
            ,
            lambda x: s_gu_min*(x[16]+x[17]+((shaojiechanliang * shaojieranliaobi / 1000 - jiaotanchanliang * cujiaolv / 100 - WT_waigoujiaotan * waigoujiaofenlv / 100 * (100 - waigoujiaoshuifen) / 100) - (100 - shaojiemeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[16] + X[17]) ) / ((100 - shaojiejiaofenshuifen) / 100 ))-
            (sm1_gu*x[16]+sm2_gu*x[17]+sl1_gu*(((shaojiechanliang * shaojieranliaobi / 1000 - jiaotanchanliang * cujiaolv / 100 - WT_waigoujiaotan * waigoujiaofenlv / 100 * (100 - waigoujiaoshuifen) / 100) - (100 - shaojiemeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[16] + X[17]) ) / ((100 - shaojiejiaofenshuifen) / 100 )))
            ,
            lambda x: sm1_mo*x[16]+sm2_mo*x[17]+sl1_mo*(((shaojiechanliang * shaojieranliaobi / 1000 - jiaotanchanliang * cujiaolv / 100 - WT_waigoujiaotan * waigoujiaofenlv / 100 * (100 - waigoujiaoshuifen) / 100) - (100 - shaojiemeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[16] + X[17]) ) / ((100 - shaojiejiaofenshuifen) / 100 ))
            -s_mo_max*(x[16]+x[17]+((shaojiechanliang * shaojieranliaobi / 1000 - jiaotanchanliang * cujiaolv / 100 - WT_waigoujiaotan * waigoujiaofenlv / 100 * (100 - waigoujiaoshuifen) / 100) - (100 - shaojiemeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[16] + X[17]) ) / ((100 - shaojiejiaofenshuifen) / 100 ))
            ,
            lambda x: s_mo_min*(x[16]+x[17]+((shaojiechanliang * shaojieranliaobi / 1000 - jiaotanchanliang * cujiaolv / 100 - WT_waigoujiaotan * waigoujiaofenlv / 100 * (100 - waigoujiaoshuifen) / 100) - (100 - shaojiemeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[16] + X[17]) ) / ((100 - shaojiejiaofenshuifen) / 100 ))-
            (sm1_mo*x[16]+sm2_mo*x[17]+sl1_mo*(((shaojiechanliang * shaojieranliaobi / 1000 - jiaotanchanliang * cujiaolv / 100 - WT_waigoujiaotan * waigoujiaofenlv / 100 * (100 - waigoujiaoshuifen) / 100) - (100 - shaojiemeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[16] + X[17]) ) / ((100 - shaojiejiaofenshuifen) / 100 )))
            ,
            lambda x: sm1_re*x[16]+sm2_re*x[17]+sl1_re*(((shaojiechanliang * shaojieranliaobi / 1000 - jiaotanchanliang * cujiaolv / 100 - WT_waigoujiaotan * waigoujiaofenlv / 100 * (100 - waigoujiaoshuifen) / 100) - (100 - shaojiemeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[16] + X[17]) ) / ((100 - shaojiejiaofenshuifen) / 100 ))
            -s_re_max*(x[16]+x[17]+((shaojiechanliang * shaojieranliaobi / 1000 - jiaotanchanliang * cujiaolv / 100 - WT_waigoujiaotan * waigoujiaofenlv / 100 * (100 - waigoujiaoshuifen) / 100) - (100 - shaojiemeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[16] + X[17]) ) / ((100 - shaojiejiaofenshuifen) / 100 ))
            ,
            lambda x: s_re_min*(x[16]+x[17]+((shaojiechanliang * shaojieranliaobi / 1000 - jiaotanchanliang * cujiaolv / 100 - WT_waigoujiaotan * waigoujiaofenlv / 100 * (100 - waigoujiaoshuifen) / 100) - (100 - shaojiemeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[16] + X[17]) ) / ((100 - shaojiejiaofenshuifen) / 100 ))-
            (sm1_re*x[16]+sm2_re*x[17]+sl1_re*(((shaojiechanliang * shaojieranliaobi / 1000 - jiaotanchanliang * cujiaolv / 100 - WT_waigoujiaotan * waigoujiaofenlv / 100 * (100 - waigoujiaoshuifen) / 100) - (100 - shaojiemeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[16] + X[17]) ) / ((100 - shaojiejiaofenshuifen) / 100 )))
            ,
            lambda x: sm1_c*x[16]+sm2_c*x[17]+sl1_c*(((shaojiechanliang * shaojieranliaobi / 1000 - jiaotanchanliang * cujiaolv / 100 - WT_waigoujiaotan * waigoujiaofenlv / 100 * (100 - waigoujiaoshuifen) / 100) - (100 - shaojiemeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[16] + X[17]) ) / ((100 - shaojiejiaofenshuifen) / 100 ))
            -s_c_max*(x[16]+x[17]+((shaojiechanliang * shaojieranliaobi / 1000 - jiaotanchanliang * cujiaolv / 100 - WT_waigoujiaotan * waigoujiaofenlv / 100 * (100 - waigoujiaoshuifen) / 100) - (100 - shaojiemeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[16] + X[17]) ) / ((100 - shaojiejiaofenshuifen) / 100 ))
            ,
            lambda x: s_c_min*(x[16]+x[17]+((shaojiechanliang * shaojieranliaobi / 1000 - jiaotanchanliang * cujiaolv / 100 - WT_waigoujiaotan * waigoujiaofenlv / 100 * (100 - waigoujiaoshuifen) / 100) - (100 - shaojiemeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[16] + X[17]) ) / ((100 - shaojiejiaofenshuifen) / 100 ))-
            (sm1_c*x[16]+sm2_c*x[17]+sl1_c*(((shaojiechanliang * shaojieranliaobi / 1000 - jiaotanchanliang * cujiaolv / 100 - WT_waigoujiaotan * waigoujiaofenlv / 100 * (100 - waigoujiaoshuifen) / 100) - (100 - shaojiemeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[16] + X[17]) ) / ((100 - shaojiejiaofenshuifen) / 100 )))
            ,
        )


        pso = PSO(func=calc_f, n_dim=dim, pop=size, max_iter=iter_num, lb=low, ub=up, w=w, c1=c1, c2=c2
                  , constraint_ueq=constraint_ueq, X=X, V=V)
        pso.record_mode = True
        pso.run()
        print('经过PSO计算得到的最优解：',pso.gbest_x)
        best_x = pso.gbest_x
        print('此时目标函数值为',calc_f(best_x))
        pbest2 = np.concatenate([pso.pbest_x, pso.pbest_y],axis=1)

        idex = np.lexsort([pbest2[:, 20]])
        sorted_data = pbest2[idex, :]

        best_5= sorted_data[[0,1,2,3,4]]
        # best_5_x = best_5[:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]]
        print('最优五组解分别是：')
        print(best_5[0])
        print(best_5[1])
        print(best_5[2])
        print(best_5[3])
        print(best_5[4])

        best_50 = best_5[0]
        best_51 = best_5[1]
        best_52 = best_5[2]
        best_53 = best_5[3]
        best_54 = best_5[4]


        def calc_f2(X):
            shenfu_penchui_wt = X[0]
            eluosi_penchui_wt = X[1]
            yongxia_penchui_wt = X[2]
            yongcheng_penchui_wt = X[3]
            changcun_penchui_wt = X[4]
            gaoping_penchui_wt = X[5]
            zhaozhuang_penchui_wt = X[6]
            yangquan2_penchui_wt = X[7]
            datongpeiQ5800_fadian_wt = X[8]
            datongpeiQ5500_fadian_wt = X[9]
            datongpeiQ5200_fadian_wt = X[10]
            datongpeiQ5000_fadian_wt = X[11]
            shenfuyuan_fadian_wt = X[12]
            shenfupei_fadian_wt = X[13]
            shenyou2_fadian_wt = X[14]
            shenwai3_fadian_wt = X[15]
            jiaozuo_shaojie_wt = X[16]
            jincheng_shaojie_wt = X[17]
            tizhi_penchui_wt = X[18]
            dingzhi_penchui_wt = X[19]
            WT_gaolulantan = (tieshuichanliang * chunmeibi / 1000 -  (100 - penchuimeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[0] + X[1] + X[2] + X[3] + X[4] + X[5] + X[6] + X[7])) / ( (100 - lantanshuifen) / 100)
            WT_dianchanglantan = (fadianliang * meidianbi / 100 * fadianmeihao / 100 * (100 + meitanwushunlv) / 100 - 100 / (100 + meitanwushunlv) * (X[8] + X[9] + X[10] + X[11] + X[12] + X[13] + X[14] + X[15]) ) / (100 / (100 + meitanwushunlv))
            WT_shaojiejiaofen = ((shaojiechanliang * shaojieranliaobi / 1000 - jiaotanchanliang * cujiaolv / 100 - WT_waigoujiaotan * waigoujiaofenlv / 100 * (100 - waigoujiaoshuifen) / 100) - (100 - shaojiemeishuifen) / 100 / (100 + meitanwushunlv) * 100 * (X[16] + X[17]) ) / ((100 - shaojiejiaofenshuifen) / 100 )
            WT_dianchanglantan = WT_dianchanglantan
            WT_shaojiejiaofen = WT_shaojiejiaofen
            gaizhi_penchui_wt = WT_gaolulantan - tizhi_penchui_wt - dingzhi_penchui_wt
            Z = tizhi_penchui_wt * tizhijiaofen_penchui_price + dingzhi_penchui_wt * dingzhilantan_penchui_price + gaizhi_penchui_wt * gaizhilantan_penchui_price + WT_dianchanglantan * price_dianchanglantan + WT_shaojiejiaofen * price_shaojiejiaofen + shenfu_penchui_wt * shenfu_penchui_price + eluosi_penchui_wt * eluosi_penchui_price + yongxia_penchui_wt * yongxia_penchui_price + yongcheng_penchui_wt * yongcheng_penchui_price + changcun_penchui_wt * changcun_penchui_price + gaoping_penchui_wt * gaoping_penchui_price + zhaozhuang_penchui_wt * zhaozhuang_penchui_price + yangquan2_penchui_wt * yangquan2_penchui_price + datongpeiQ5800_fadian_wt * datongpeiQ5800_fadian_price + datongpeiQ5500_fadian_wt * datongpeiQ5500_fadian_price + datongpeiQ5200_fadian_wt * datongpeiQ5200_fadian_price + datongpeiQ5000_fadian_wt * datongpeiQ5000_fadian_price + shenfuyuan_fadian_wt * shenfuyuan_fadian_price + shenfupei_fadian_wt * shenfupei_fadian_price + shenyou2_fadian_wt * shenyou2_fadian_price + shenwai3_fadian_wt * shenwai3_fadian_price + jiaozuo_shaojie_wt * jiaozuo_shaojie_price + jincheng_shaojie_wt * jincheng_shaojie_price
            Z2 = Z + WT_waigoujiaotan * price_waigoujiaotan + WT_lianjiaomei * price_lianjiaomei
            return WT_gaolulantan,WT_dianchanglantan,WT_shaojiejiaofen,Z2

        print(calc_f2(best_x))
        # print('最优五组解对应的替代品种重量及总总价格')

        WT_gaolulantan0, WT_dianchanglantan0, WT_shaojiejiaofen0, Z20= calc_f2(best_5[0])
        WT_gaolulantan1, WT_dianchanglantan1, WT_shaojiejiaofen1, Z21= calc_f2(best_5[1])
        WT_gaolulantan2, WT_dianchanglantan2, WT_shaojiejiaofen2, Z22= calc_f2(best_5[2])
        WT_gaolulantan3, WT_dianchanglantan3, WT_shaojiejiaofen3, Z23= calc_f2(best_5[3])
        WT_gaolulantan4, WT_dianchanglantan4, WT_shaojiejiaofen4, Z24= calc_f2(best_5[4])

        # print(calc_f2(best_5[0]))
        # print(calc_f2(best_5[1]))
        # print(calc_f2(best_5[2]))
        # print(calc_f2(best_5[3]))
        # print(calc_f2(best_5[4]))
        elapsed = float((datetime.datetime.now() - start).seconds)
        print("Time Used 4 All ----->>>> %f seconds" % (elapsed))
        data = {
            '方案': ['不考虑可控资源', '考虑可控资源', '其他1', '其他2', '其他3', '其他4', '其他5'],
            '神府': [Achushi_x11,chushi_x11,best_50[0], best_51[0], best_52[0], best_53[0], best_54[0]],
            '俄罗斯': [Achushi_x12,chushi_x12,best_50[1], best_51[1], best_52[1], best_53[1], best_54[1]],
            '永夏': [Achushi_x13,chushi_x13,best_50[2], best_51[2], best_52[2], best_53[2], best_54[2]],
            '永城': [Achushi_x14,chushi_x14,best_50[3], best_51[3], best_52[3], best_53[3], best_54[3]],
            '常村': [Achushi_x15,chushi_x15,best_50[4], best_51[4], best_52[4], best_53[4], best_54[4]],
            '高平': [Achushi_x16,chushi_x16,best_50[5], best_51[5], best_52[5], best_53[5], best_54[5]],
            '赵庄': [Achushi_x17,chushi_x17,best_50[6], best_51[6], best_52[6], best_53[6], best_54[6]],
            '阳泉2#': [Achushi_x18,chushi_x18,best_50[7], best_51[7], best_52[7], best_53[7], best_54[7]],
            '大同配Q5800': [Achushi_x21,chushi_x21,best_50[8], best_51[8], best_52[8], best_53[8], best_54[8]],
            '大同配Q5500': [Achushi_x22,chushi_x22,best_50[9], best_51[9], best_52[9], best_53[9], best_54[9]],
            '大同配Q5200': [Achushi_x23,chushi_x23,best_50[10], best_51[10], best_52[10], best_53[10], best_54[10]],
            '大同配Q5000': [Achushi_x24,chushi_x24,best_50[11], best_51[11], best_52[11], best_53[11], best_54[11]],
            '神府原': [Achushi_x25,chushi_x25,best_50[12], best_51[12], best_52[12], best_53[12], best_54[12]],
            '神府配': [Achushi_x26,chushi_x26,best_50[13], best_51[13], best_52[13], best_53[13], best_54[13]],
            '神优2': [Achushi_x27,chushi_x27,best_50[14], best_51[14], best_52[14], best_53[14], best_54[14]],
            '神外3': [Achushi_x28,chushi_x28,best_50[15], best_51[15], best_52[15], best_53[15], best_54[15]],
            '焦作': [Achushi_x31,chushi_x31,best_50[16], best_51[16], best_52[16], best_53[16], best_54[16]],
            '晋城': [Achushi_x32,chushi_x32,best_50[17], best_51[17], best_52[17], best_53[17], best_54[17]],
            '烧结焦粉': [Achushi_shaojie,chushi_shaojie,WT_shaojiejiaofen0, WT_shaojiejiaofen1, WT_shaojiejiaofen2, WT_shaojiejiaofen3, WT_shaojiejiaofen4],
            '电厂兰炭': [Achushi_fadian,chushi_fadian,WT_dianchanglantan0, WT_dianchanglantan1, WT_dianchanglantan2, WT_dianchanglantan3,
                     WT_dianchanglantan4],
            '改制兰炭': [Achushi_gaolu_gaizhi,chushi_gaolu_gaizhi,WT_gaolulantan0-best_50[18]-best_50[19], WT_gaolulantan1-best_51[18]-best_51[19], WT_gaolulantan2-best_52[18]-best_52[19], WT_gaolulantan3-best_53[18]-best_53[19], WT_gaolulantan4-best_54[18]-best_54[19]],
            '提质焦粉': [Achushi_gaolu_tizhi, chushi_gaolu_tizhi, best_50[18], best_51[18], best_52[18], best_53[18], best_54[18]],
            '定制兰炭': [Achushi_gaolu_dingzhi,chushi_gaolu_dingzhi, best_50[19], best_51[19], best_52[19], best_53[19], best_54[19]],
            '总价格': [Achushi_z,chushi_z,Z20, Z21, Z22, Z23, Z24]

        }

        # , '备注': ['耗时', elapsed, '迭代次数', iter_num, '粒子数', size, ''],'备注': ['耗时',elapsed,'迭代次数',iter_num,'粒子数',size,'']
        df_zuiyou = pd.DataFrame(data=data)
        df_zuiyou = df_zuiyou.round({'神府':5,'俄罗斯':5,'永夏':5,'永城':5,'常村':5,'高平':5,'赵庄':5,'阳泉2#':5,'大同配Q5800':5,'大同配Q5500':5,'大同配Q5200':5,'神府原':5,'神府配':5,'神优2':5,'神外3':5,'焦作':5,'晋城':5,'烧结焦粉':5,'电厂兰炭':5,'改制兰炭':5,'提质焦粉':5,'定制兰炭':5,'总价格':5})
        print(df_zuiyou)
        # XDataFrameUtils.dataframe2excel(p_dataframe=df_zuiyou, p_file_name="test_202211011.xls",
        #                                 p_override_force=True)
        table_1 = list()
        table_1.append({'plan': '考虑可控资源',
                        'p1': round(chushi_x11,3),
                        'p2': round(chushi_x12,3),
                        'p3': round(chushi_x13,3),
                        'p4': round(chushi_x14,3),
                        'p5': round(chushi_x15,3),
                        'p6': round(chushi_x16,3),
                        'p7': round(chushi_x17,3),
                        'p8': round(chushi_x18,3),
                        'd1': round(chushi_x21,3),
                        'd2': round(chushi_x22,3),
                        'd3': round(chushi_x23,3),
                        'd4': round(chushi_x24,3),
                        'd5': round(chushi_x25,3),
                        'd6': round(chushi_x26,3),
                        'd7': round(chushi_x27,3),
                        'd8': round(chushi_x28,3),
                        's1': round(chushi_x31,3),
                        's2': round(chushi_x32,3),
                        'sl1': round(chushi_shaojie,3),
                        'dl1': round(chushi_fadian,3),
                        'pl1': round(chushi_gaolu_gaizhi,3),
                        'pl2': round(chushi_gaolu_tizhi,3),
                        'pl3': round(chushi_gaolu_dingzhi,3),
                        'price': round(chushi_z,3)})
        table_1.append({'plan': '不考虑可控资源',
                        'p1': round(Achushi_x11,3),
                        'p2': round(Achushi_x12,3),
                        'p3': round(Achushi_x13,3),
                        'p4': round(Achushi_x14,3),
                        'p5': round(Achushi_x15,3),
                        'p6': round(Achushi_x16,3),
                        'p7': round(Achushi_x17,3),
                        'p8': round(Achushi_x18,3),
                        'd1': round(Achushi_x21,3),
                        'd2': round(Achushi_x22,3),
                        'd3': round(Achushi_x23,3),
                        'd4': round(Achushi_x24,3),
                        'd5': round(Achushi_x25,3),
                        'd6': round(Achushi_x26,3),
                        'd7': round(Achushi_x27,3),
                        'd8': round(Achushi_x28,3),
                        's1': round(Achushi_x31,3),
                        's2': round(Achushi_x32,3),
                        'sl1': round(Achushi_shaojie,3),
                        'dl1': round(Achushi_fadian,3),
                        'pl1': round(Achushi_gaolu_gaizhi,3),
                        'pl2': round(Achushi_gaolu_tizhi,3),
                        'pl3': round(Achushi_gaolu_dingzhi,3),
                        'price': round(Achushi_z,3)})
        table_1.append({'plan': '其他1',
                        'p1': round(best_50[0],3),
                        'p2': round(best_50[1],3),
                        'p3': round(best_50[2],3),
                        'p4': round(best_50[3],3),
                        'p5': round(best_50[4],3),
                        'p6': round(best_50[5],3),
                        'p7': round(best_50[6],3),
                        'p8': round(best_50[7],3),
                        'd1': round(best_50[8],3),
                        'd2': round(best_50[9],3),
                        'd3': round(best_50[10],3),
                        'd4': round(best_50[11],3),
                        'd5': round(best_50[12],3),
                        'd6': round(best_50[13],3),
                        'd7': round(best_50[14],3),
                        'd8': round(best_50[15],3),
                        's1': round(best_50[16],3),
                        's2': round(best_50[17],3),
                        'sl1': round(WT_shaojiejiaofen0,3),
                        'dl1': round(WT_dianchanglantan0,3),
                        'pl1': round(WT_gaolulantan0-best_50[18]-best_50[19],3),
                        'pl2': round(best_50[18],3),
                        'pl3': round(best_50[19],3),
                        'price': round(Z20,3)})
        table_1.append({'plan': '其他2',
                        'p1': round(best_51[0],3),
                        'p2': round(best_51[1],3),
                        'p3': round(best_51[2],3),
                        'p4': round(best_51[3],3),
                        'p5': round(best_51[4],3),
                        'p6': round(best_51[5],3),
                        'p7': round(best_51[6],3),
                        'p8': round(best_51[7],3),
                        'd1': round(best_51[8],3),
                        'd2': round(best_51[9],3),
                        'd3': round(best_51[10],3),
                        'd4': round(best_51[11],3),
                        'd5': round(best_51[12],3),
                        'd6': round(best_51[13],3),
                        'd7': round(best_51[14],3),
                        'd8': round(best_51[15],3),
                        's1': round(best_51[16],3),
                        's2': round(best_51[17],3),
                        'sl1': round(WT_shaojiejiaofen1,3),
                        'dl1': round(WT_dianchanglantan1,3),
                        'pl1': round(WT_gaolulantan1-best_51[18]-best_51[19],3),
                        'pl2': round(best_51[18],3),
                        'pl3': round(best_51[19],3),
                        'price': round(Z21,3)})
        table_1.append({'plan': '其他3',
                        'p1': round(best_52[0],3),
                        'p2': round(best_52[1],3),
                        'p3': round(best_52[2],3),
                        'p4': round(best_52[3],3),
                        'p5': round(best_52[4],3),
                        'p6': round(best_52[5],3),
                        'p7': round(best_52[6],3),
                        'p8': round(best_52[7],3),
                        'd1': round(best_52[8],3),
                        'd2': round(best_52[9],3),
                        'd3': round(best_52[10],3),
                        'd4': round(best_52[11],3),
                        'd5': round(best_52[12],3),
                        'd6': round(best_52[13],3),
                        'd7': round(best_52[14],3),
                        'd8': round(best_52[15],3),
                        's1': round(best_52[16],3),
                        's2': round(best_52[17],3),
                        'sl1': round(WT_shaojiejiaofen2,3),
                        'dl1': round(WT_dianchanglantan2,3),
                        'pl1': round(WT_gaolulantan2-best_52[18]-best_52[19],3),
                        'pl2': round(best_52[18],3),
                        'pl3': round(best_52[19],3),
                        'price': round(Z22,3)})
        table_1.append({'plan': '其他4',
                        'p1': round(best_53[0],3),
                        'p2': round(best_53[1],3),
                        'p3': round(best_53[2],3),
                        'p4': round(best_53[3],3),
                        'p5': round(best_53[4],3),
                        'p6': round(best_53[5],3),
                        'p7': round(best_53[6],3),
                        'p8': round(best_53[7],3),
                        'd1': round(best_53[8],3),
                        'd2': round(best_53[9],3),
                        'd3': round(best_53[10],3),
                        'd4': round(best_53[11],3),
                        'd5': round(best_53[12],3),
                        'd6': round(best_53[13],3),
                        'd7': round(best_53[14],3),
                        'd8': round(best_53[15],3),
                        's1': round(best_53[16],3),
                        's2': round(best_53[17],3),
                        'sl1': round(WT_shaojiejiaofen3,3),
                        'dl1': round(WT_dianchanglantan3,3),
                        'pl1': round(WT_gaolulantan3-best_53[18]-best_53[19],3),
                        'pl2': round(best_53[18],3),
                        'pl3': round(best_53[19],3),
                        'price': round(Z23,3)})
        table_1.append({'plan': '其他5',
                        'p1': round(best_54[0],3),
                        'p2': round(best_54[1],3),
                        'p3': round(best_54[2],3),
                        'p4': round(best_54[3],3),
                        'p5': round(best_54[4],3),
                        'p6': round(best_54[5],3),
                        'p7': round(best_54[6],3),
                        'p8': round(best_54[7],3),
                        'd1': round(best_54[8],3),
                        'd2': round(best_54[9],3),
                        'd3': round(best_54[10],3),
                        'd4': round(best_54[11],3),
                        'd5': round(best_54[12],3),
                        'd6': round(best_54[13],3),
                        'd7': round(best_54[14],3),
                        'd8': round(best_54[15],3),
                        's1': round(best_54[16],3),
                        's2': round(best_54[17],3),
                        'sl1': round(WT_shaojiejiaofen4,3),
                        'dl1': round(WT_dianchanglantan4,3),
                        'pl1': round(WT_gaolulantan4-best_54[18]-best_54[19],3),
                        'pl2': round(best_54[18],3),
                        'pl3': round(best_54[19],3),
                        'price': round(Z24,3)})


        print('finish')
        message = '最优解'
        return message, table_1